添加事件处理程序为DropDownList里面的GridView - 如何? [英] Adding Event Handler to DropDownList inside GridView - how to?

查看:115
本文介绍了添加事件处理程序为DropDownList里面的GridView - 如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的DropDownList里面的GridView。现在,我想补充的事件处理程序的DropDownList这将上的SelectedIndexChanged反应。
我用的RowDataBound事件的GridView嵌套GridView控件里的DropDownList。
(http://www.highoncoding.com/Articles/169_DropDownList_Inside_GridView__Method_1_.aspx)
任何人可以帮助我,并告诉我如何添加事件处理的DropDownList,好吗?

I have DropDownList inside GridView. Now I would like to add event handler for dropdownlist which would react on SelectedIndexChanged. I'm nesting DropDownList inside GridView by using RowDataBound event for GridView. (http://www.highoncoding.com/Articles/169_DropDownList_Inside_GridView__Method_1_.aspx) Can anybody help me, and tell me how to add event handling for dropdownlist, please?

推荐答案

好吧,我有这个问题就解决了​​。
为了处理的SelectedIndexChanged 的嵌套GridView控件DropDownList的,你必须只设置自动回属性真实和点SelectedIndexChange事件的一些过程。

ok, the issue I've had is solved. To handle SelectedIndexChanged for DropDownList nested inside GridView you have to just set AutoPostback property to true and point SelectedIndexChange event to some procedure.

问题我的原因是,我没有在Page_Load中功能检查(数据绑定到GridView的期间)以下规则:如果没有Page.IsPostBack然后。就这样。所以,不要忘记这样做,请! :)

The cause of issue I had was that I didn't check in Page_Load function (during binding data to GridView) following rule: If Not Page.IsPostBack Then. And that's all. So don't forget to do it please! :)

这篇关于添加事件处理程序为DropDownList里面的GridView - 如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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