Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Disabled button loses OnClientClick?
Message
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Client-side développement
Titre:
Disabled button loses OnClientClick?
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP
Database:
MS SQL Server
Divers
Thread ID:
01326425
Message ID:
01326425
Vues:
71
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
Répondre
Fil
Voir

Click here to load this message in the networking platform