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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Playing with button's Enabled status in Client & Server side

Status
Not open for further replies.

markros

Programmer
May 21, 2007
3,150
US
Hi everybody,

I have a complex AJAX web page, that uses several UpdatePanels.

I have a DropDown and a button and bellow a GridView in the UpdatePanel which has button.Click and DropDown.SelectedIndexChange as its triggers.

The GridView has checkboxes in each row (template field). The DropDown above the grid switches between Approved/Non Approved statuses (and also alters GridView display - sets different columns, etc.).

The initial value of DropDown is Non Approved (Awaiting Approval) and the Approve button should be disabled. Once I check a any checkbox in a grid, I'd like my button to become Enabled.

If I switch to Approved status, the checkboxes in the grid show disabled and the button should be disabled as well.

This is my idea of UI.

Now I have several problems with the implementation of this idea.

1. My button has an OnClientClick JavaScript code (just a confirmation message) in ASPX. It worked before I started to play around with Enabled status of the button. Now this confirmation message is not displayed.

2. Once I enable my button from the CheckBox click event (I add OnClick Attribute in DataRowBound event of the GridView using disabled = false in JavaScript) I found that setting Enabled property in Server side code no longer works, e.g. button remains enabled despite the Button.Enabled = false in C# code.

So, do you think I can not mix Server side with Client-side code like I'm trying to do? Or there are other better ways to achieve the desired functionality?

Thanks a lot in advance.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top