嵌套的gridview ...查找父级控制ID [英] Nested gridview...Find the parent conrol id
本文介绍了嵌套的gridview ...查找父级控制ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我有一个父gridview.它在每行中都有子gridview.这个孩子的编辑和删除事件正常.当我通过带有空数据模板的子gridview向其中添加数据时,找不到父控件ID的值.如何找到合适的父母ID?我正在使用C#和VS2008
gvProductFeatures是chid gridview ...
Hi all,
I have a parent gridview. It has child gridview in every row. The edit and delete event of this child is working is fine. When I add data to through child gridview with empty data template, I can''t find the value of the parent control id. How can I find the appropriate parent id? I am using C# and VS2008
gvProductFeatures is the chid gridview...
protected void gvProductFeatures_RowCommand(object sender, GridViewCommandEventArgs e)
{
try
{
if (e.CommandName.Equals("EmptyAddNewFeature"))
{
GridView gv = (GridView)sender;
if (gv != null)
{
// here i need find the appropriate control id from parent..how??
int intIndex = Convert.ToInt32(e.CommandArgument);
Label lblEmptyGroupPK = (Label)gv.Controls[0].Controls[0].FindControl("lblEmptyGroupPK");
TextBox txtEmptyFeatures = (TextBox)gv.Controls[0].Controls[0].FindControl("txtEmptyFeatures");
}
}
}
catch(Expection ex)
{
}
推荐答案
gv.Parent怎么样?父级获得对页面控件层次结构中服务器控件的父级控件的引用.
我个人更喜欢使用 ASPxGridView [
How about gv.Parent? Parent gets a reference to the server control''s parent control in the page control hierarchy.
Personally I prefer using ASPxGridView[^]
Regards
Espen Harlinn
这篇关于嵌套的gridview ...查找父级控制ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文