I have an asp:radiobuttonlist that serves two purposes depending on which button is pushed. Now if I have my update button visible, then it will only show textbox1, and if I have my save button visible, it will show textbox2. However, when checking within the method of the indexChanged, it discards the fact that the button is visible and sets the buttons to their default visibility. How would I capture the information in C# on whether a certain button is visible or not before that information is discarded in a postback?
views:
91answers:
3
+1
A:
What sets the visibility on the textbox? If it's code behind, could you store the state of the page in ViewState, Session, or Application that would provide the logic you need?
Chris Porter
2009-12-21 19:28:04
Yes, it's set in the code behind. However, I'm a tad new to the web programming, so I guess I'll have a look at all those things you mentioned.
Justen
2009-12-21 19:31:48
+1
A:
Where are you setting the visibility of the buttons? If you're setting it on the server side, you should just be able to check the Visible property of the button. If you're setting it on the client side (i.e. via javascript) you could update a hidden field control with the visibility info, then grab that value on the index changed postback.
WayneC
2009-12-21 19:34:01
+1
A:
If the buttons are static buttons on the page(not dynamically generated by code), then their state should stay the same unless other code is changing their visibility.
Can you post your "Page_Load" method's code?
Eclipsed4utoo
2009-12-21 19:34:06
Ah, this simplifies it a bit. I had all my visibility being done outside of the !Page.IsPostBack.
Justen
2009-12-21 19:55:59
That was going to be my suggestion. Common mistake of most beginners to ASP.Net.
Eclipsed4utoo
2009-12-21 20:47:15