开发者

masterpage with usercontrol problem

I have a masterpage and 2 usercontrols(A.ascx & B.ascx) on this masterpage. In these one of them usercontrol(A.ascx) have another usercontrol(C.ascx). And I use this masterpage on default.aspx page. On this Default.aspx page we have one more usercontrol i.e. (D.ascx).

Now my problem is that I want to changeover the css class of C.ascx usercontrol on changing in D.ascx. Or 开发者_如何学运维how to call and access any function of c.ascx in user control d.ascx.

Hence this d.ascx in on default.aspx page and c.ascx is in masterpage usercontrol's usercontrol.


UserControl B = (UserControl)this.NamingContainer.NamingContainer.FindControl("B1");   
B.GetType().GetMethod("check").Invoke(B,null).ToString();


Below might help you.

 UserControl C = (UserControl)this.NamingContainer.FindControl("A").FindControl("C");  

You can access any method of user control c by its Object"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜