更新面板导致验证问题。 [英] update panel causing validation problem.

查看:88
本文介绍了更新面板导致验证问题。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



在我的项目中我使用的是更新面板,工作正常,但问题在于我的验证是在更新面板下。当我没有在我的文本框中提供任何数据并提交表格,验证无效。



请建议我一些解决方案并记住我不能添加任何DDL到我的申请。



提前致谢

Syed

Hello,

In my project i m using an update panel,which is working fine but the problem is with my validation which is under the update panel.When i m not giving any data in my text boxes and submitting the form the validation is not working.

Please suggest me some solution and remember i can't add any DDL into my application.

Thanks in Advance
Syed

推荐答案

请参阅此处。 。:)



演练:在UpdatePanel控件中使用验证控件 [ ^ ]
Refer this.. :)

Walkthrough: Using Validation Controls Inside an UpdatePanel Control[^]


请再次查看您的代码..以下是工作

please check your code once again.. below is working
<asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>







<asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate>
      <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><asp:RequiredFieldValidator runat="server" ID="rfvtxt1" ControlToValidate="TextBox1" ErrorMessage="Required"></asp:RequiredFieldValidator>
      <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
      <asp:Label ID="Label1" runat="server" Text=""></asp:Label>
          </ContentTemplate>
          </asp:UpdatePanel>



和背后的代码


and code behind

protected void Button1_Click(object sender, EventArgs e)
   {
       Label1.Text = "the value is:" + TextBox1.Text; //any code
   }


这篇关于更新面板导致验证问题。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆