访问GridView下拉列表中的DropDownList可以绑定数据库,国家,州,城市 [英] Accessing a DropDownList inside a GridView Dropdownlist can bind database ,country,state,city

查看:66
本文介绍了访问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....


这篇关于访问GridView下拉列表中的DropDownList可以绑定数据库,国家,州,城市的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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