GridView项目模板字段内的多个DropDownLists [英] Multiple DropDownLists Inside the GridView Item Template Field

查看:70
本文介绍了GridView项目模板字段内的多个DropDownLists的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我在GridView项Tempalte字段内有两个DropDownList,具有父子关系.因此,我想从父项下拉列表中选择某些项,并根据父项选择填充子项下拉列表.方案

实现级联下拉列表 [
//您的代码

}


hi,
i have two DropDownLists inside the GridView Item Tempalte Field,have a parent-child relationship.So, iwant to select some item from the parent dropdown and fill the child dropdown list based on the parent selection.

Implementing Cascading Dropdown List[^] should help you out.


protected void ddl1_SelectedIndexChanged(object sender, EventArgs e)

{

string foundID = String.Empty;

GridViewRow row = (GridViewRow)((sender) as Control).NamingContainer;

// getting the value from the first dropdownlist

DropDownList ddlfirst = ((sender) as DropDownList);

int ddlfirstSelectedValue = Convert.ToInt32(ddlfirst.SelectedValue);

string firstDropDownListID = ddlfirst.UniqueID;

// and now here is how

DropDownList ddlSecond = row.FindControl("ddl2") as DropDownList;

// your code

}


这篇关于GridView项目模板字段内的多个DropDownLists的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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