动态创建文本框 [英] Creating Textboxes dynamically

查看:85
本文介绍了动态创建文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在我的项目中,我需要在点击添加按钮时动态创建2个文本框,所以当点击添加按钮时,我需要并排产生2个文本框,并且相同的位置由侧面文本框?



所以请给我解决方案



从非复制的其他信息下面的解决方案

实际上我在我的页面上动态获取控件。我需要获得上面提到的相同的差距和位置吗?



从2以下的非解决方案复制的其他信息

我只是在使用asp.net网页表单时我需要在点击时动态获取2个texbox添加按钮,然后单击添加按钮时,它应生成两个与下面位置相同的文本框。

Hi,
In my project I need to create 2 textboxes dynamically when clicking on add button,so when click on add button I need to generate 2 textboxes side by side with same position of side by side textboxes?

So please give me the solution

additional information copied from non-solution below
Actually I am getting the controls dynamically on my page.Here I need to get with equal gap and position which I mentioned above?

additional information copied from non-solution below 2
I am just using asp.net web forms only there I need to get 2 texboxes dynamically when clicking add button and next when clicking add button it should generate two textboxes adjascent with same as the position below.

推荐答案

你还没有谷歌。你有吗? [ ^ ]


请参阅这些链接



在ASP.NET中创建动态文本框控件


以编程方式在ASP.Net中创建控件

以编程方式向ASP.NET网页添加控件

如何在运行时动态创建TextBox控件

添加T.通过单击按钮在运行时动态弹出框

如何添加文本框 - 动态使用Csharp

如何在asp.net和c#中动态创建文本框

Create-TextBox-dynamically-using-c-Windows-Form-Winforms-Application

使用C#在表单中动态添加多个textBox?

此处还有更多内容
see These Links

CREATING DYNAMIC TEXTBOX CONTROLS IN ASP.NET

Create controls in ASP.Net programmatically
Add Controls to an ASP.NET Web Page Programmatically
How To Create TextBox Control Dynamically at Runtime
Adding Text box dynamically at run time by clicking on button
How-to-Add-Textbox-dynamically-using-Csharp
How to dynamically create textboxes in asp.net and c#
Create-TextBox-dynamically-using-c-Windows-Form-Winforms-Application
dynamically add multiple textBoxes in the form using C#
And more Here


根据需要读取和修改代码。

Read and modify code as you want.
//Declaring the variable with limit
int n=1;
for (int i=0;i<n;i++)
{
TextBox MyTextBox=new TextBox();
//Assigning the textbox ID name
MyTextBox.ID = "txtb_" + i;
MyTextBox.Width = 540;
MyTextBox.Height = 60;
MyTextBox.TextMode = TextBoxMode.MultiLine;
this.Controls.Add(MyTextBox);
}


这篇关于动态创建文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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