带下拉菜单的Gridview [英] Gridview With Dropdown

查看:83
本文介绍了带下拉菜单的Gridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在模板字段(Gridview)中使用下拉菜单,还有另一个使用标签COntrol的模板字段

请帮帮我

当用户更改下拉值(或项目)时,其他模板字段
值(标签)应更改

例如
下拉值
1
2
3

当用户选择1时,标签模板字段"的值应为是",并且在
上 标签的值不得为"0"
像这样

I am Using Dropdown in Template Field(Gridview) there is another Template Field Using Label COntrol

Please Help me

When User Change Drop Down value (or item)the other template fields
value (Label )should get changed

for example
drop down values
1
2
3

When User Select 1 the label Template Fields value should be "yes" and on
no value of label should be "0"
Like this

推荐答案

您需要为此进行事件冒泡,因为子控件不会自行引发任何事件.我们需要为GridView的RowCommand事件创建一个事件处理程序.在此事件处理程序中,我们首先检查传入的CommandName值以确定引发哪个控件的事件,然后采取适当的自定义操作.本文将提供有关引发rowcommand事件的更多信息

技巧/提示:使用提交"按钮从子DropDownList控件引发GridView RowCommand事件 [ ^ ]
You need to do event bubbling for this as child controls do not raise any events on its own & need to be bubbled to GridView their parent.To accomplish this, we need to create an event handler for the RowCommand event of GridView. In this event handler we first check the incoming CommandName value to determine which control''s event is raised and then take appropriate custom action.This article will give more idea on raising rowcommand event

Trick/Tip: Raise a GridView RowCommand event from a child DropDownList control using a Submit button[^]


1只需触发一个DropDown_SelectedIndexChanged事件
2)获取下拉列表的行数
3)找到必需的标签以进行连续更改
4)根据要求设置标签值.

[ ^ ]对下拉列表的自动回传几乎没有帮助.
1)Just fire a DropDown_SelectedIndexChanged event
2)Get a row no of Dropdown
3)Find a Required lable to change in a row
4)Set Lable value as per requirement.

THIS[^] will little help you in AutoPostback Of Dropdown.


这篇关于带下拉菜单的Gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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