在行编辑过程中如何在动态添加的控件的Grid的行更新事件中查找值 [英] How to find value in row updating event of Grid of dynamically added control during row editing

查看:84
本文介绍了在行编辑过程中如何在动态添加的控件的Grid的行更新事件中查找值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友,


帮助我找出Grid的行更新事件中下拉列表的值.该下拉列表是在行数据绑定事件中的行编辑过程中添加的.

我也尝试过在Row创建的事件中添加相同的控件并绑定相同的数据源.但是我无法进行更新.

(((DropDownList)gvTest.Rows [e.RowIndex] .FindControl("ddl")));值作为null抛出,并抛出未设置为参考错误的对象实例.



请帮助

谢谢
Siva

Hi Friends,


Help me to find out the value of dropdown in the row updating event of Grid.That drop down is added during row edit in the Row data bound event.

I have also tried adding the same control and binded same datasource in Row created event also.But i could not do the update.

((DropDownList)gvTest.Rows[e.RowIndex].FindControl("ddl")); value comes as null and throw instance of object not set to its reference error.



Please Help

Thanks
Siva

推荐答案

,如果发生do
in the event do
GridViewRow gRow = GriwViewRow(sender);
GridView grid = (GridView)gRow.NamingContainer;
grid.SelectedIndex = gRow.RowIndex;


现在,您可以执行gRow.FindControl(").
最后做


Now you can do a gRow.FindControl("").
at the end do

grid.SelectedIndex = -1;


这篇关于在行编辑过程中如何在动态添加的控件的Grid的行更新事件中查找值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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