如何在GridView中获取下拉值 [英] How to get the dropdown value in GridView

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

问题描述

亲爱的所有人,

如何在GridView网格中获取下拉值.请帮忙.

谢谢
Basit.

Dear All,

How to get the dropdown value in GridView Grid. Please help on that.

Thanks
Basit.

推荐答案

您的下拉列表只是一个选择控件.您的网格是否显示所有行的下拉列表,您需要全部读取它们?选定的行可以迭代通过后,可以使用FindControl方法在行中查找控件.
Your drop down is just a select control. Does your grid show drop downs for all the rows and you need to read them all ? Once you have the selected row, which you can iterate through, you can use the FindControl method to find the control in your row.


^ ]


也许此链接可以为您提供适当的帮助
http://www.codeproject.com/script/Articles/ArticleVersion.aspx?waid=24677&aid=414526[^]


May be this link will help you properly


您可以使用FindControl方法.

试试类似的东西:
You can use FindControl method.

Try something like:
// Accessing dropdown of each row
foreach (GridViewRow item in myGrid.Rows)
{   
    DropdownList myDropdownList = (DropdownList)item.FindControl("myDropdownList");
    string text = myDropdownList.SelectedValue;                
} 


这篇关于如何在GridView中获取下拉值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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