访问GridView下拉列表中的DropDownList可以绑定数据库,国家,州,城市

问题描述:

在GridView中访问DropDownList。下拉列表可以从数据库绑定,如国家,州,城市

Accessing a DropDownList inside in a GridView. Dropdownlist can bind from database like country,state,city

绑定DropDownList



方法1:使用SqlDataSource

方法2:在Page_Load中绑定ddl。并且不要忘记添加IsPostBack



从DropDownList获取数据



To bind the DropDownList

Method 1 : Use SqlDataSource
Method 2 : Bind the ddl in Page_Load. And don't forget to add IsPostBack

To Get the data from DropDownList

GridViewRow gvr = Gridview.Rows[e.NewEditIndex];
DropDownList dr = (DropDownList)gvr.FindCo

ntrol(ddlName);

string s = dr.SelectedValue.ToString();



如果您要求,请详细说明您的问题......

ntrol("ddlName");
string s = dr.SelectedValue.ToString();

Please elaborate your problem when ever you are asking....