开发者

Call an event on Web Control Load

I am loading my with web controls and loading them based on the URL parameters.

I need to load a gridview if the user is 开发者_JS百科in :&cat=8

My web control has a method which I need to call. One of its parameters is a session which is created only when the category is 8.

Technically I need a way of calling methods within my web control from my page. Placing it on page_load results in an error.

Thanks


You need to bind an event-handler on Load event of the Control itself.

private void Page_Load (object sender, System.EventArgs e)
{   
   // Add the following code:
   yourControl.Load += new EventHandler(yourControl_Load);

}


private void yourControl_Load (object sender, System.EventArgs e)
{
    //your code here.
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜