开发者

Asp.net access method from user control access method

I've a user control registered 开发者_开发问答in an aspx page On click event of a button in the aspx page, how do i call a method which is there in the user control? I need to execute the method in user control on click event of button in aspx page.

Thanks....


// Below might help

UserControl B = new UserControl();
Object[] parameters = new Object[2];
parameters[0] = 45;
parameters[1] = "test"; 
B = (UserControl)Page.FindControl("[UserControlId]");
B.GetType().GetMethod("[MethodName]").Invoke(B, parameters);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜