I have an asp:radiobuttonlist that serves two purposes depending on which button is pushed. Now if I 开发者_JAVA技巧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?
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?
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?
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.
精彩评论