使用DropDownList&在GridView中添加动态行文本框并将数据绑定到DropDownList. [英] Adding Dynamic Row in GridView With DropDownList & TextBox and Bind Data To DropDownList.

查看:89
本文介绍了使用DropDownList&在GridView中添加动态行文本框并将数据绑定到DropDownList.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我想在带有``DropDownList''和``TextBox''的``GridView''中添加动态行.
并将数据从表绑定到"DropDownList".当我单击"LinkBut​​ton"时会发生这种情况
请回复.

Hi,
I want to adding dynamic row in ''GridView'' with ''DropDownList'' & ''TextBox''.
And bind Data to ''DropDownList'' from Table. And it happen when i click on ''LinkButton''
Please reply.

推荐答案

好,您尝试了什么?您是什么意思当我单击链接按钮时会发生这种情况"?您可以定义一列以包含一个下拉列表,然后为该下拉列表定义一个数据源.您还可以使用数据绑定事件来查找控件,将其绑定并设置其初始值.网络上存在大量示例.
OK, what have you tried ? What do you mean ''it happen when I click on linkbutton'' ? You can define a column to contain a drop down list, and then define a data source for that drop list. You can also use the data bound event to find the control, bind it, and set it''s initial value. Tons of examples exist on the web.




您可以对此进行用户控制.并在按钮单击事件时调用该用户控件.
Hi

You can make user control for that. and call that user control at button click event.


如果我说对了,您想在网格视图中添加两行,其中一列包含下拉列表(绑定到某些数据源) )和另一个文本框.

gridview不支持插入.但是有一种解决方法-使用页脚模板来执行此操作.您可以在页脚模板列中添加dropdownlist和textbox控件.您可以按其ID访问dropdownlist和textbox.在LinkBut​​ton上,单击u可以将gridview.FooterRow.visible属性设置为true.如果您有任何问题,请告诉我.

希望对您有帮助...
If i am getting you right, you want to add a row to the gridview with two columns - one containing dropdownlist (bound to some data source) and another textbox.

gridview doesn''t support insertion. But there is a workaround - use footer template to do so. You can add dropdownlist and textbox control in the footer template column. you can access both dropdownlist and textbox by their Id''s. On LinkButton click u can set gridview.FooterRow.visible property to true. Let me know if you have any issues.

Hope it helps...


这篇关于使用DropDownList&在GridView中添加动态行文本框并将数据绑定到DropDownList.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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