且构网

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

gridview中的下拉列表

更新时间:2023-02-11 20:00:32

欢迎访问该网站。请提供更多信息并清楚地描述您的问题。谢谢。
Welcome to the site. Please provide more information and describe your problem clearly. Thanks.


多才多艺!

只需在模板字段中的itemtemplate中添加下拉框。

然后在vb,
gridview rowcommand中的


获取所选下拉框的值,

ctype(me.gridview。 rows(gridview中所选行的编号).findcontrol(" yourdropdownbox"),dropdownl ist).selectedvalue
thats easy man!
just add the dropdown box in an itemtemplate inside a templatefield.

then in vb,
in gridview rowcommand,
get the value of the selected dropdown box by,
ctype(me.gridview.rows(the number of the selected row in gridview).findcontrol("yourdropdownbox"),dropdownl ist).selectedvalue



很容易男人!

只需在模板字段中的itemtemplate中添加下拉框。

然后在vb中,

in gridview rowcommand,

获取所选下拉框的值,

ctype(me.gridview.rows(gridview中所选行的编号).findcontrol(" ; yourdropdownbox"),dropdownl ist).selectedvalue
thats easy man!
just add the dropdown box in an itemtemplate inside a templatefield.

then in vb,
in gridview rowcommand,
get the value of the selected dropdown box by,
ctype(me.gridview.rows(the number of the selected row in gridview).findcontrol("yourdropdownbox"),dropdownl ist).selectedvalue



感谢您帮助我......但我仍然有一个问题,我怎么能得到所选行的数量在gridview .....我tr使用Gridview.editIndex属性,但它给我负面索引..........

实际上我要做的是在gridview中单击编辑按钮后我必须添加下拉列表的记录和我在< asp:template field>中使用的文本框在数据库......单击更新按钮后,两个字段的记录应该根据他们的id添加到数据库中,这已经在gridveiw中.....


To说清楚......我已经填好了。

ID DROPDOWN TEXTBOX编辑





Id是使用gridview的select comman生成的,但使用templatefield添加了下拉列表.........因此我必须在点击编辑按钮后更新下拉列表和txtbox ..


Thanks for helping me...But i still have an problem that, how i can get the number of selected row in gridview .....I tried using Gridview.editIndex property but it give me negative index ..........
Actually what i have to do is after clicking edit button in gridview i have to add record of dropdownlist and textbox which i used in <asp:template field> in database......After clicking update button the record of both field should get added in database according to their id, which was already in gridveiw.....

To Make clear.... I have follwing filleds.
ID DROPDOWN TEXTBOX edit
.
,
Id was generated using select comman of gridview ,,but dropdown list is added using templatefield.........therefor i have to update rec of dropdown and txtbox after clicking edit button..