如何在ASP.NET动态添加一个文本框? [英] How do I add a textbox dynamically in ASP.NET?

查看:181
本文介绍了如何在ASP.NET动态添加一个文本框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有个以下要求为我的asp.net页面:

I've a following requirement for my asp.net page:


  1. 用户可以动态地在一个页面点击链接添加一个文本框的添加新类别的超链接

  1. User can add a textbox dynamically on a page A by clicking on link "Add a new category" hyperlink

他点击提交网页上的按钮和被重定向到网页B。

He clicks submit button on page A and gets redirected to page B.

在他页面上点击此页面的链接,那他补充说,应坚持文本框。

When he clicks on page A link from this page, the textboxes that he added should be persisted.

有人可以帮助我对这个code?

Can someone help me with the code on this?

鸭preciate您的帮助!

Appreciate your help!

推荐答案

在ButtonClick方法写。

In the ButtonClick Method write.

TextBox tb = new TextBox();

Parent.Controls.Add( tb );

家长是您要添加的文本框,例如面板控制。

The Parent is the control you want to add the textbox to, for instance a panel.

您也可以看看这个资源

希望它帮助。

这篇关于如何在ASP.NET动态添加一个文本框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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