用户如何控制页面上的引用对象 [英] how can user controls reference objects on the page
问题描述
如何从该页面上的用户控件引用页面上的数据网格?
在我的用户控件中,我想要这样的东西...... 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
推荐答案
Max写道:
如何从该页面上的用户控件引用页面上的数据网格?
在我的用户控件中,我想要这样的东西... 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
您可以在页面上创建一个公共函数,该函数返回对
数据网格的引用。 />
然后从你的用户控件中你可以说:
Dim dg as datagrid = Page.MyDataGridFunction()
-
我希望这会有所帮助,
Steve C. Orr,MCSD,MVP
http://Steve.Orr.net
" Max" <毫安***** @ portvista.com>在消息中写道
news:kx ********************* @ twister.tampabay.rr.c om ...
You could make a public function on the page that returns a reference to the
datagrid.
Then from within your user control you could say:
Dim dg as datagrid = Page.MyDataGridFunction()
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Max" <ma*****@portvista.com> wrote in message
news:kx*********************@twister.tampabay.rr.c om...
如何从该页面上的用户控件引用页面上的数据网格?
在我的用户控件中,我想要这样的东西...... 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
Craig Deelsnyder写道:
Craig Deelsnyder wrote:
Max写道:
Max wrote:
如何从该页面上的用户控件引用页面上的数据网格?
在我的用户控件中,我想要这样的东西。 .. MyDataGrid
在页面上,而不是在用户控件中...我可能会做一个byref来将
传递给其中一个潜艇,但我听说那是没有效果的......
MyDataGrid.Current PageIndex + = 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")
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
这篇关于用户如何控制页面上的引用对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!