单击按钮后的gerate控件(文本框,下拉列表)。 [英] gerate control(textbox,dropdown) after click on button.

查看:92
本文介绍了单击按钮后的gerate控件(文本框,下拉列表)。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





i点击addbutton后想要控制(文本框,下拉列表)。

将数据绑定到dropdown.all this控制在div或面板内部。

所以当用户想要填充数据时,他点击addbutton会看到新的记录生成。

解决方案

< blockquote>使用以下功能并根据您的要求进行更改: -

如果您想生成多个控件,则为每个控件提供唯一ID。



 私有  void  Add_Click()
{
// 这将创建控件
var newTextbox = new TextBox();
var newDropdownlist = new DropDownList();

// 将文本框和下拉列表添加到面板或表单,然后将面板添加到表格
newPanel.Controls.Add(newLabel);
newPanel.Controls.Add(newTextbox);
form1.Controls.Add(newPanel);
}


然后简单地给属性中的文本框或组合框赋予true或false,然后单击on text功能到你的文本框..


hi,

i want to gerate control(textbox,dropdown) after click on addbutton.
bind data to dropdown.all this control is inside of div or panel.
so when user want to fill data more then one he click on addbutton see new record genrated.

解决方案

Use below function and made changes according to your requirement:-
if you want to generate multiple controls then give unique id for each control.

private void Add_Click()
       {
           //This will create the controls
           var newTextbox = new TextBox();
           var newDropdownlist = new DropDownList();

           // add the textbox and dropdown to the panel or form, then add the panel to the form
           newPanel.Controls.Add(newLabel);
           newPanel.Controls.Add(newTextbox);
           form1.Controls.Add(newPanel);
       }


then simplyyy give true or false to the textbox or combo box in properties and then onclick function to ur textbox..


这篇关于单击按钮后的gerate控件(文本框,下拉列表)。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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