gridview中的下拉列表 [英] Dropdownlist in gridview

查看:81
本文介绍了gridview中的下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在gridview中添加d​​ropdownlist框.......这样在从dropdownlist框中选择特定项后,它会在数据库中更新......使用edititemtemplate字段......

How can i add dropdownlist box in gridview.......such that after selecting perticular item from dropdownlist box it get updated in database......using edititemtemplate field......

推荐答案

欢迎访问该网站。请提供更多信息并清楚地描述您的问题。谢谢。
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..


这篇关于gridview中的下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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