问题描述
如何从该页面上的用户控件引用页面上的数据网格?
在我的用户控件中,我想要这样的东西...... MyDataGrid在页面上是
,而不是在用户控件中...我可能会做一个byref将
传递给其中一个潜艇,但我听说那是没有效果......
MyDataGrid.CurrentPageIndex + = 1
How do I reference a datagrid on a page from a user control on that page?
In my user control, I''d like to have something like this... MyDataGrid being
on the page, not in the user control... I could probably do a byref to pass
it into one of the subs, but I heard that was not effecient...
MyDataGrid.CurrentPageIndex += 1
推荐答案
用户控件有一个名为.Page的属性,你可以从中使用
FindControl方法
thisControl.Page.FindControl(" myDataGridID")
-
Craig Deelsnyder
Microsoft MVP - ASP / ASP.NET
The user control has a property called .Page from which you can use the
FindControl method
thisControl.Page.FindControl("myDataGridID")
--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
用户控件有一个名为.Page的属性,你可以从中使用
FindControl方法
thisControl .Page.FindControl(" myDataGridID")
The user control has a property called .Page from which you can use the
FindControl method
thisControl.Page.FindControl("myDataGridID")
请注意这应该是
Page.FindControl(" myDataGridID")
来自用户控件.....
-
Craig Deelsnyder
Microsoft MVP - ASP / ASP.NET
note this should be
Page.FindControl("myDataGridID")
from inside the user control.....
--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
这篇关于用户如何控制页面上的引用对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!