首页 新闻 会员 周边

请教Request.Form["content"]怎么是char类型的

0
悬赏园豆:20 [已关闭问题] 关闭于 2012-08-19 08:32
<body>
       
    <form id="form1" runat="server">
       
    <p>
        <input id="Button1" type="button" value="button" onclick="addbtn()" /><asp:Button ID="Button2" 
            runat="server" onclick="Button2_Click" Text="Button" />
    </p>
       <div id="test"></div>
       
    </form>
    <script type="text/javascript">
        function addbtn() {
            var div = document.getElementById("test");
            var btn = document.createElement("input");
            btn.type = "text";
            btn.name = "content";          
            div.appendChild(btn);
        }
    </script>
</body>
 protected void Button2_Click(object sender, EventArgs e)
    {
        for (int i = 0; i < Request.Form["content"].Count(); i++)
        {
            Response.Write(Request.Form["content"][i].ToString()+"<br/>");
        }
    }

 

我用JS动态创建文本框,然后在后台获取动态区域的值,现在用Request.Form["content"]获到是所有字符串连在一起的值,如何获得每个文本框的值呢?

happydaily的主页 happydaily | 菜鸟二级 | 园豆:301
提问于:2012-08-19 08:24
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册