Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Disabled button loses OnClientClick?
Message
 
 
To
All
General information
Forum:
ASP.NET
Category:
Client-side development
Title:
Disabled button loses OnClientClick?
Environment versions
Environment:
C# 3.0
OS:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
01326425
Message ID:
01326425
Views:
69
Hi everybody,

I have an Approve button with this code in ASPX:
<asp:Button ID="bntApprove" runat="server" Text="Approve" Enabled ="false" 
                                        OnClick="bntApprove_Click" Style="margin-left: 0px" ToolTip="Approve all selected people"
                                        OnClientClick="return confirm('Do you want to approve all selected people?');" />
In my code I activate the button using this code (for now there is no check if all buttons are unclicked):

GridView (RowBound event):
CheckBox chkButton = e.Row.FindControl("chkApproved") as CheckBox;
            if (chkButton != null)
            {
                if (this.ddlApprovedStatus.SelectedIndex == 0)
                {
                    chkButton.ToolTip = "Approve " + PersonName;
                    string JScript = "var btn = document.getElementById('" +
                                     this.bntApprove.ClientID + @"')
                                     if (btn)
                                        { //alert('CheckBox Clicked');
                                          btn.disabled = false;}";
                    chkButton.Attributes.Add("OnClick", JScript);  
                    chkButton.Enabled = true;
                }
                else
                    chkButton.Enabled = false;
            }
However, I found that my confirmation message is gone. Do you know why? I'd like to keep the confirmation message, any ideas of how to achieve my goal?

Thanks again.
If it's not broken, fix it until it is.


My Blog
Reply
Map
View

Click here to load this message in the networking platform