如何在asp.net中使用jquery验证表单而不在客户端插件 [英] How to validate form using jquery in asp.net without plugin on clientside

查看:44
本文介绍了如何在asp.net中使用jquery验证表单而不在客户端插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<form id="form1" runat="server">
    <div id="registration">
    <h1>Registration</h1>
        <table>

            <tr><td>StudentID</td><td>
                <asp:TextBox ID="txtstdid" runat="server" Width="200" Height="20"></asp:TextBox></td></tr>

            <tr><td>Name</td><td>
                <asp:TextBox ID="txtname" runat="server" Width="200" Height="20"></asp:TextBox></td></tr>

            <tr><td>RollNumber</td><td>
                <asp:TextBox ID="txtrnum" runat="server" Height="20" Width="200"></asp:TextBox></td></tr>
            <tr><td>Course</td>&nbsp<td><asp:DropDownList ID="drpcor" runat="server">
                <asp:ListItem Text="B.Tech"></asp:ListItem>
                <asp:ListItem Text="M.Tech"></asp:ListItem>
                <asp:ListItem Text="MCA"></asp:ListItem>
                                  </asp:DropDownList>
</td></tr>
            <tr><td>Section</td><td><asp:DropDownList ID="drpbrn" runat="server">
                 <asp:ListItem Text="Select"></asp:ListItem>
                <asp:ListItem Text="A"></asp:ListItem>
                <asp:ListItem Text="B"></asp:ListItem>
                <asp:ListItem Text="C"></asp:ListItem>
                                   </asp:DropDownList>
</td></tr>

            <tr><td>Email</td><td>
                <asp:TextBox ID="txtemail" runat="server" Width="200" Height="20"></asp:TextBox></td></tr>
            <tr><td>Address</td><td>
                <asp:TextBox ID="txtaddress" runat="server" TextMode="MultiLine" Height="20" Width="200"></asp:TextBox>
                </td></tr>
            <tr><td>Photo</td><td>
                <asp:FileUpload ID="FileUpload1" runat="server" /></td></tr>

            <tr><td>&nbsp</td><td><asp:Button ID="btnsubmit" runat="server" Text="Submit"/></td></tr>

        </table>

    </div>
    </form>









谢谢





thank you

推荐答案

您可以通过jQuery编写自己的验证逻辑。不需要任何外部插件。



你有文本框的id。使用它来选择控件,然后在提交按钮单击事件中进行验证。
You can code your own validation logic by jQuery. No need of any external plugin.

You have the id of textbox. Use that to select the control and then validate inside the submit button click event.


这篇关于如何在asp.net中使用jquery验证表单而不在客户端插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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