开发者

How to call method inside of usercontrol which is nested inside of RadDockableObject from content page?

Here is my code. I'm able to find Asp.net UserControl and play with attributes but I need to call specific method inside of 开发者_C百科it. Can anyone tell me how to do it?

var usercontrol = (UserControl)RadDockableObject1.FindControl("ControlName");
usercontrol.Visible = true;
usercontrol.MethodName();


You need to cast it to the appropriate type. Right now you are casting it to UserControl. That will give you access to a set of properties and methods, but not all. Cast it to the particular type and you will have access to everything. Everything that is not-private that is...


Just cast it to your control type instead of UserControl f.e.

var myControl = (SpecificControlName)RadDockableObject1.FindControl("ControlName");
myControl.SpecificMethod();
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜