如何在按钮单击事件中一次动态添加2个文本框 [英] how to add 2 textbox dynamically at a time in button click event

查看:80
本文介绍了如何在按钮单击事件中一次动态添加2个文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每个ADD按钮点击事件在coulum中一次创建2个文本框

every ADD button click event Create 2 textbox at a time in a coulum

推荐答案

TextBox tb;
static int i = 0;
protected void Button_Click(object sender, EventArgs e)
{
        i++;
    for(j=0;j<=i;j++)
    {
    tb = new TextBox();
    tb.ID = j.ToString();

    PlaceHolder1.Controls.Add(tb);
    }

}





这意味着您需要再次创建添加的文本框...因为您正在动态地向页面添加控件...



that means you need to create the added textbox again...because you are adding control dynamically to the page...


这篇关于如何在按钮单击事件中一次动态添加2个文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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