Databind()GridView来自项目模板内的UserControl [英] Databind() GridView From UserControl inside Item Template
本文介绍了Databind()GridView来自项目模板内的UserControl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好。
我在Gridview模板中使用了我的userControl。
我的UC功能之一就是我可以删除来自usercontrol的那一行。
有什么方法可以当我删除行时,Databind() - 刷新gridview,从UC代码后面?
提前谢谢。
Hi every one.
I used my userControl inside Gridview template.
One of my UC features, is that i can delete that row from usercontrol.
Is there any way that when i delete row, Databind()-Refresh gridview, From UC code behind ?
Thanks in advance.
推荐答案
一个技巧是你可以在更新面板内输出gridview。从您的用户控件,您可以更新Gridview。希望这对你有所帮助。
--SG
One trick is that you can out your gridview inside a UPDATE PANEL. and from your user control you can update the Gridview. Hope this help you.
--SG
嘿那里,
以下是你可以做的:
创建一个公共方法来绑定GridView
GridView
所在的页面,假设方法名称为BindGrid
,您的页面名称为Test1
,所以在UserControl CodeBehind中你可以这样做:
Hey there,
Here is what you can do:
Create a public method to bind theGridView
on the page where theGridView
resides, let say method name isBindGrid
, and your page name isTest1
, So in UserControl CodeBehind you can do this:
Test1 myPage = (Test1)this.Page;
if (myPage != null)
{
myPage.BindGrid();
}
希望它有所帮助。
Azee。 ..
Hope it helps.
Azee...
您可以通过再次将数据绑定到gridview来刷新gridview。
You can refresh your gridview by again binding the data to gridview.
这篇关于Databind()GridView来自项目模板内的UserControl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文