可以控制呼叫父母&有价值回归吗? [英] can control call parent & have value returned to it?
问题描述
我有一个ascx控件,它需要一个名为''orgID''的值,父级
页面将具有该值。我想避免ascx控件中的字段中的父页面设置值,因为这违反了封装原则,
SO ...
I想知道InvokeMember是否可以用来从
父级返回一个值。 ie:
输入myParent = this.Page.GetType();
string strOrgid = myParent.InvokeMember(" GetOrgID",System.Reflection .. 。
null,this.Page,new object [] {});
如果我在返回字符串的父项上创建GetOrgID函数,可以
以上工作?
或者是否有更好的方法让ascx向其父母请求价值。
TY Jason Shohet
排序类似你的问题,我正在寻找各种各样的方式
从ascx控件调用我的父页面上的一个函数,并在下面的那个上结算
。我在VB中调用函数而不是返回一个
属性(你可能想要一个属性而不是一个
变量)。
(本例中的页面是MainReport.aspx)
Dim myParent As MainReport
myParent = CType(HttpContext.Current.Handler,MainReport )
myParent.LoadFilter()
***通过Developersdex发送 http://www.developersdex.com ***
不要只是参加USENET ......获得奖励!
类似于你的问题,我正在寻找各种各样的方式
从ascx控件调用我的父页面上的一个函数,并在下面的一个结算
。我在VB中调用函数而不是返回一个
属性(你可能想要一个属性而不是一个
变量)。
(本例中的页面是MainReport.aspx)
Dim myParent As MainReport
myParent = CType(HttpContext.Current.Handler,MainReport )
myParent.LoadFilter()
***通过Developersdex发送 http://www.developersdex.com ***
不要只是参加USENET ......获得奖励!
我知道如何从ascx控件调用父页面上的func ...但是
可以在父页面上获得乐趣将值返回给ascx吗?多数民众赞成我在寻找
。吉姆你的LoadFilter()函数,它可以返回一个值为
调用ascx?或者我的Invoke功能(在线程中进一步显示),可以返回一个值的
...
TY Jason
I have an ascx control, and it needs a value called ''orgID'' which the parent
page will have. I want to avoid the parent page setting values in fields on
the ascx control since this violates encapsulation principles,
SO...
I want to know if InvokeMember can be used to return a value from the
parent. ie:
Type myParent = this.Page.GetType();
string strOrgid = myParent.InvokeMember("GetOrgID", System.Reflection...
null, this.Page, new object[]{ });
If I make GetOrgID a function on the parent that returns a string, can the
above work?
Or is there a better way for the ascx to request values from its parent.
TY Jason Shohet
Sort of similar to your problem, I was looking at various ways of
calling a function on my parent page from a ascx control, and settled on
the one below. I''m in VB and calling a function rather than returning a
property (and you probably want to have a property rather than a
variable).
(The page in this case is MainReport.aspx)
Dim myParent As MainReport
myParent = CType(HttpContext.Current.Handler, MainReport)
myParent.LoadFilter()
*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!
Sort of similar to your problem, I was looking at various ways of
calling a function on my parent page from a ascx control, and settled on
the one below. I''m in VB and calling a function rather than returning a
property (and you probably want to have a property rather than a
variable).
(The page in this case is MainReport.aspx)
Dim myParent As MainReport
myParent = CType(HttpContext.Current.Handler, MainReport)
myParent.LoadFilter()
*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!
I know how to call a func on the parent page from the ascx control... but
can that fun on the parent page RETURN a value to the ascx? Thats what i''m
looking for. Jim your LoadFilter() func, can it return a value to the
calling ascx? Or my Invoke function (shown further up in the thread), can
that return a value...
TY Jason
这篇关于可以控制呼叫父母&有价值回归吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!