如何使用jquery或javascript添加动态asp.net文本框控件 [英] How to add dynamic asp.net textbox controls using jquery or javascript

查看:60
本文介绍了如何使用jquery或javascript添加动态asp.net文本框控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我是javascript的新手,我有一个要求。当我点击+按钮时,应该添加下面的行控件。只使用asp.net控件..不要使用html控件......

请你告诉编码吗?

这是我的编码...





Hello,
I am new to javascript that I have a requirement.When I click + button the below row controls should be added. By using only asp.net control..Dont use html controls...
Would you please tell the coding for that?
This is my coding...


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MedicalAndPolicies.aspx.cs" Inherits="Tax_Declaration_Format.MedicalAndPolicies" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js" type="text/javascript"></script>
    <title></title>
    <style type="text/css">
        .style1
        {
            font-size: xx-large;
        }
        .style2
        {
            font-size: medium;
        }
    </style>



   <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
    $(document).ready(function () {

        var selector = $('#<%= MAndP1.ClientID %>');

       selector.hide();
        $('#<%= Yes.ClientID %>').change(function () {
            debugger
            selector.show();
        });

        $('#<%= No.ClientID %>').click(function () {
            selector.hide();
        });
    });

</script>

</head>
<body>
    <form id="form1" runat="server">
    <div align="center" class="style1">
        <strong>Medical And Policies</strong>

    <table id="MAndP" align="center">
        <tr>

            <td class="style2"><strong>Are parents included or not:</strong></td>
            <td>
                <asp:RadioButton ID="Yes"  runat="server" GroupName="YesOrNo" Text="Yes" onchange="handleChange1();"

                    style="font-size: medium" />
                <asp:RadioButton ID="No" runat="server" GroupName="YesOrNo" Text="No"  onchange="handleChange1();"

                    style="font-size: medium" /></td>
                </tr>
                </table>

    <table id="MAndP1" align="center"  runat="server">

        <tr>
            <td><asp:TextBox ID="TxtName"  placeholder="Enter Parent Name" runat="server"

                   ></asp:TextBox></td>
            <td><asp:TextBox ID="TxtAge" runat="server" placeholder="Enter Age"

                    Width="130px"></asp:TextBox></td>
                    <td>
                        <asp:FileUpload ID="FU1" runat="server" Width="184px" /></td>

            <td><asp:Button ID="BtnPlus" runat="server" Text="+"

                    onclick="BtnPlus_Click"  Width="24px" /></td>
             <td><asp:Button ID="BtnMinus" runat="server" Text="-"  /></td>

        </tr>
        </table>

    <table runat="server" id="MAndP2" align="center">

        <tr><td><asp:TextBox ID="TxtPloicyValue" runat="server" placeholder="Enter Policy Amount"></asp:TextBox></td>
        <td>
            <asp:Button ID="BtnPlusValue" runat="server" Text="+" /></td>
        </tr>
        </table>
        </div>


    </form>
</body>
</html>

推荐答案

document )。ready( function (){

var selector =
(document).ready(function () { var selector =


' #<%= MAndP1.ClientID%>');

selector.hide();
('#<%= MAndP1.ClientID %>'); selector.hide();


' #<%= Yes.ClientID%>')。change( function (){
调试器
selector.show();
});
('#<%= Yes.ClientID %>').change(function () { debugger selector.show(); });


这篇关于如何使用jquery或javascript添加动态asp.net文本框控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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