返回首页

亲爱的主席先生,

我有5个文本框,txt1中,txt2,txt3,txt4和txt5。

我用在不同的表提交的2个按钮,一个用于插入和一个
我的问题是如何使用插入按钮上所有的TextBox验证,以及如何使用两个submit按钮texbox验证

提前感谢,

回答

评论会员:koolprasad2003 时间:2012/02/07
的JavaScript会为你工作。这里是为您提示


function ValidateTextboxes(objID)

{

   if(document.getElementById(objID).value == "Insert") //check if insert button press

   {

     //validate all textboxes

   }

   elseif(document.getElementById(objID).value=="Submit") //check if submit button pressed

   {

      //validate only 2 textboxes

   }

}


以上功能onclient点击按钮调用ID作为参数

<asp:button id="btnSubmit" runat="server" value="click me" onclientclick="ValidateTextboxes(this.id)" />
评论会员:游客 时间:2012/02/07
迪内希ķ孔雀:这是问题的非常有用的链接拳头检查IIS版本,如果您的IIS版本是比服务器IIS版本较低,然后按照这个链接imgsrc=]
| tamkeen sheraj:你需要做这样


  <div>

    <asp:textbox id="txt1" text="sheraj" style=" text-decoration:blur" runat="server" ></asp:textbox>

    

<asp:requiredfieldvalidator id="r1" controltovalidate="txt1" errormessage="error1" validationgroup="btng" runat="server" ></asp:requiredfieldvalidator>

      

    <asp:textbox id="txt2" runat="server" ></asp:textbox>

 

--here u need to use two RequiredFieldValidatorfro 2nd text box 

    

     <asp:requiredfieldvalidator id="RequiredFieldValidator1" controltovalidate="txt2" errormessage="error1" validationgroup="bt1" runat="server" ></asp:requiredfieldvalidator>

 

     <asp:requiredfieldvalidator id="RequiredFieldValidator2" controltovalidate="txt2" errormessage="error2" validationgroup="bt2" runat="server" ></asp:requiredfieldvalidator>

 

     <asp:button id="btn1" runat="server" validationgroup="bt1" text="insert " >

    </asp:button>

      

     <asp:button id="btn2" runat="server" validationgroup="bt2" text="update">

      </asp:button>

  

   <asp:button id="btn3" runat="server" causesvalidation="false" text="some opretion">

      </asp:button>

 

</div>

希望它会帮助你:shek124
评论会员:游客 时间:2012/02/07
虚假的CausesValidation属性的按钮
Bhupendra肖汉
评论会员:游客 时间:2012/02/07
。您可以使用JavaScript的{体C3}和你的CS页面上使用此如功能{的C4}
Dalek戴夫