无法正确绑定嵌套网格 [英] Unable to bind nested grid properly

查看:136
本文介绍了无法正确绑定嵌套网格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述







我有一个嵌套网格(父网格1,子网格2)。我在行命令事件上显示grid2 grid1。我试图在grid2的rowcommand事件上更新grid2,但它没有正确绑定。我通过断点发现最新的reocrds绑定grid2但它没有显示最新的记录。

Hi,


I have a nested grid(parent grid1,child grid2).i am displaying grid2 on row command event of grid1. I am trying to update grid2 on rowcommand event of grid2 but its not binding properly. I found through breakpoint that latest reocrds are binding grid2 but it is not displaying latest records.

推荐答案

你有什么尝试?告诉我们代码。也许您的绑定存在问题。

您可以参考可编辑的嵌套GridView(多功能一体机)
What have you tried? Show us that code. Maybe there is a problem with your binding.
You could refer Editable Nested GridView (All-in-One)


protected void ParentGrid_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Update")
{
ImageButton img = (ImageButton)e.CommandSource as ImageButton;
GridViewRow row = img.NamingContainer as GridViewRow;
            
GridView chil= (GridView )row.FindControl("ChildgridId");
 
SqlCommand cmd=new SqlCommand("select * from table",connectionstring);
Dataset ds;
SqlDataAdapter ad=new SqlDataAdapter(cmd);
ad.Fill(ds);
Bind the values from the query to Chil datasource
 
chil.DataSource=ds;
chil.DataBind();
 
}
 
}


嗨Sravan,

这里我给你有一个链接,请参与那个真正有助于嵌套gridview可编辑的链接。

Nested-gridview-Edit




[ ^ ]




感谢你!
Hi Sravan,
Here i give you one link kindly go threw in that link that will really help to do nested gridview editable.
Nested-gridview-Edit


[^]


Thanking you!


这篇关于无法正确绑定嵌套网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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