如何在datagrid中绑定dropdownlist [英] how to bind dropdownlist in datagrid

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

问题描述

我将在datagrid项目模板中创建一个包含两个dropdownlsts的应用程序.我想使用itemtemplate根据第一个下拉列表中的值填充第二个下拉列表.我如何调用第一个下拉列表的选择索引填充第二个下拉列表.我已将第一个dropdownlist的autopostback属性设置为true

i m creating an application that contains two dropdownlsts in a datagrid item template. i would like to fill the second dropdownlist according to the value in first drop downlist using itemtemplate. how can i invoke the selcted index change of first dropdown to fill the second dropdownlist. i have enabled the autopostback property of first dropdownlist to true

推荐答案

转到任务
点击编辑模板
选择包含下拉列表的列,然后选择项目模板
现在双击下拉列表.
go to tasks
click on edit template
select the column which contain dropdownlist and then select item template
now double click on dropdownlist.


希望 [
Hope this[^] might help you.


simply,

manually write dropdown selectindexchanged event in sourcefile and .cs file and set autopostback=true.
then in selectedindexchanged event use sender object to retreive combobox selectedindex and text and use dropdownlist clientid to get selected row like

DropDownList ddl = (DropDownList)sender;

string s = ddl.ClientID;//use substring to retreive rowindex
if (ddl.SelectedItem.Text == "Your selected text")
{
dropdown1.Items.FindByText("Your text"].ToString()).Selected=true;}


这篇关于如何在datagrid中绑定dropdownlist的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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