相关疑难解决方法(0)

在保持CausesValidation和OnClick-Method的同时单击后禁用按钮

的.aspx

 <asp:TextBox ID="txtInvite" Width="170px" Height="20px" runat="server" 
                          Font-Size="Small" ></asp:TextBox>

                          <AjaxToolkit:TextBoxWatermarkExtender ID="tbexInvite" 
                          runat="server" SkinID="skinTextBoxWatermarkExtender" 
                          TargetControlID="txtInvite" WatermarkText="Email"></AjaxToolkit:TextBoxWatermarkExtender>

                          <asp:RequiredFieldValidator ID="rfvInvite" runat="server" 
                          Display="None" ValidationGroup="Inivitation" SetFocusOnError="true" 
                          ControlToValidate="txtInvite" ErrorMessage="Enter Email."></asp:RequiredFieldValidator>

                          <asp:RegularExpressionValidator ID="regExpInvite" runat="server" 
                          Display="None" ValidationGroup="Inivitation" SetFocusOnError="true" 
                          ValidationExpression="\s*\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*\s*" 
                          ControlToValidate="txtInvite" ErrorMessage="Invalid Email Format."></asp:RegularExpressionValidator>

 <div  class="ButtonLogin" style="margin-top:-27px;margin-right:143px;_margin-right:105px;">
                        <asp:UpdatePanel ID="UpdatePanel1" runat="server" >
                          <ContentTemplate>
                            <asp:Button ID="btnInvite" runat="server" CssClass="cssLoginButton blue" Text="Invite" ToolTip="Invite" ValidationGroup="Inivitation" CausesValidation="true" onclick="btnInvite_Click" />

                          </ContentTemplate>
                       </asp:UpdatePanel>
                 </div>
                      <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1" DisplayAfter="0">
                           <ProgressTemplate>
                                  <asp:Image ID="Image1" ImageUrl="~/App_Themes/Lifetrons/images/progressbar.gif" AlternateText="Processing" runat="server" />
                           </ProgressTemplate>
                      </asp:UpdateProgress>
Run Code Online (Sandbox Code Playgroud)

Page_load代码

.CS

this.btnInvite.Attributes.Add("onclick", "this.disabled=true;" + Page.ClientScript.GetPostBackEventReference(this.btnInvite, "").ToString());
Run Code Online (Sandbox Code Playgroud)

我想通过维护验证和Onlick方法点击它后禁用按钮.我提到这个问题我的问题和这个问题一样,但我没有解决我的问题.我怎么解决?

c# asp.net

1
推荐指数
1
解决办法
8659
查看次数

标签 统计

asp.net ×1

c# ×1