如何在c#.net中找出动态文本框ID和文本 [英] how to find out the dynamic textboxes id and text in c#.net

查看:62
本文介绍了如何在c#.net中找出动态文本框ID和文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我在c#中创建了动态文本框,但没有找到 id和文本框文本.任何机构都知道如何查找文本框ID和文本框文本,您都将为我共享信息.



在此先感谢


i created dynamic text boxes in c#, but i didn''t find out that id as well as textboxes text. any body know how to find out the text box id and text box text, you will share the information for me.



Thanks in Advance

推荐答案

受保护的void Page_Load(对象发送者,EventArgs e)
{
TextBox new_textbox = new TextBox();
new_textbox.ID ="txt" +1;
new_textbox.Text =";
PlaceHolder1.Controls.Add(new_textbox);
}

受保护的void Button1_Click(对象发送者,EventArgs e)
{
字符串OptionID ="txt" +1;
TextBox tb =(TextBox)PlaceHolder1.FindControl(OptionID);
Response.Write(tb.Text);


}
}
protected void Page_Load(object sender, EventArgs e)
{
TextBox new_textbox = new TextBox();
new_textbox.ID = "txt" + 1;
new_textbox.Text = "";
PlaceHolder1.Controls.Add(new_textbox);
}

protected void Button1_Click(object sender, EventArgs e)
{
string OptionID = "txt" + 1;
TextBox tb = (TextBox)PlaceHolder1.FindControl(OptionID);
Response.Write(tb.Text);


}
}


这篇关于如何在c#.net中找出动态文本框ID和文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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