Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data Binding

Status
Not open for further replies.

Kalisto

Programmer
Feb 18, 2003
997
GB
Im just trying to establish if Im on the right track here, or if Im trying to do something impossible.

Asp.Net 2003. Windows Form.

I have a number of buttons on my form. In my code behind the form, I have created a property that returns true or false.

I am assuming that I can than add a binding to the buttons that refers to this property, and uses it to set the Enabled property.

However, when I then change the status of that property, the enabled status of the buttons isnt changing.

So, what step have I missed, or is what Im doing simply not possible with buttons?

Cheers
K
 
I'm not 100% sure what you're asking here - have I got this right?

1. You've added one or more buttons to a web form
2. You've created a boolean variable in your codebehind that returns true or false
3. You want the 'Enabled' property of the buttons to be set the same as this boolean variable i.e.:

Code:
bool boolTrueFalse = false;
btnButton1.Enabled == boolTrueFalse;

and when we're talking about btnButton1.Enabled you mean making it so that the user can or can't press the button?

4. You're finding that when you change the boolean variable from True to False and back again, your buttons are not changing their Enabled state?

If all the above is correct, then it sounds to me more like a problem with posting back to the server. The status of the button will only change on a postback event, so you need to make sure that when you're posting back you're calling the procedure that is changing the status of your buttons.

But maybe I haven't understood, in which case explain some more and I'll try and help.
 
Thanks Mark, youve sort of got it, only this is a stand alone application, not a web based application. I was looking to see if theres some kind of postback / redraw mechanism I need to use, but it turns out that it look slike I need to use some kind of really badly named class (currency iirc) to manage my databindings. At which point I lost my patience with it, and just wrote a number of .visible = true or false statements in my code.

Cheers anyway

K
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top