且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用DropDownList&在GridView中添加动态行文本框并将数据绑定到DropDownList.

更新时间:2023-10-07 09:47:46

好,您尝试了什么?您是什么意思当我单击链接按钮时会发生这种情况"?您可以定义一列以包含一个下拉列表,然后为该下拉列表定义一个数据源.您还可以使用数据绑定事件来查找控件,将其绑定并设置其初始值.网络上存在大量示例.
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...