首页| JavaScript| HTML/CSS| Matlab| PHP| Python| Java| C/C++/VC++| C#| ASP| 其他|
购买积分 购买会员 激活码充值

您现在的位置是:虫虫源码 > HTML/CSS > 在网格视图 上级联下拉列表

在网格视图 上级联下拉列表

资 源 简 介

翻译 maninwest@Codeforge   作者:Tadit Dash @ Codeproject 文章将展示如何在网格视图GridView  本身呈现的下拉列表DropDownList  的 SelectedIndexChanged 事件中,获取GridView 的当前行,然后找到其他下拉列表并进行绑定背景当我在进行项目时,需要根据其他列上呈现的 DropDownList的选择,绑定一个列上的 DropDownList。这有些像级联下拉列表,两个 下拉列表呈现在同一个网格视图上。解决步骤是:1. 为第一个GridView 上的 DropDownList 附加 SelectedIndexChanged 事件2. 在事件内,首先获取 GridView 行,从中选择第一个 DropDownList 3. 然后从当前GridView 行中,找到第二个 DropDownList ,并跟数据表 DataTable 或其他东西捆绑。网格视图标记在标记Markup 中,你可以看到GridView 中声明了两个DropDownLists。一个是用于国家Country,另一个是用于城市 City。为了演示,我硬编码了国家Country的项目。您可以使用代码动态填充。注意:第一步,我已经将  OnSelectedIndexChanged  事件附加到Country DropDownList 中。目标:在行中选定Country后,为 特定行填充City DropDownList

文 件 列 表

CascadingDropDownListOnGridView
bin
CascadingDropDownListOnGridView.csproj
CascadingDropDownListOnGridView.csproj.user
CascadingDropDownListOnGridView.sln
CascadingDropDownListOnGridView.suo
GridViewWithCascadingDropDownLists.aspx
GridViewWithCascadingDropDownLists.aspx.cs
GridViewWithCascadingDropDownLists.aspx.designer.cs
obj
Properties
Service References
Web.config
Web.Debug.config
Web.Release.config
VIP VIP
0.174324s