call .ascx control in button or a link or link button..

Posted by Gopal_nivas under ASP.NET on 12/27/2010 | Points: 10 | Views : 3949 | Status : [Member] | Replies : 2
hi..

how to call the .ascx(user control) file in button or a link or linkbutton..

need ur suggestions with examples..

regards
gopal.s




Responses

Posted by: Lalji_mer on: 12/27/2010 [Member] Bronze | Points: 25

Up
0
Down
Hi,

check this link

http://forums.asp.net/p/1608054/4105009.aspx

LP MER

Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Karthikanbarasan on: 1/6/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
 protected void LoadControl(string control)


{

Panel p = Panel1;

Control c = LoadControl(control);

p.Controls.Add(c);

}

protected void Page_Init(object sender, EventArgs e)

{

LoadControl("UserControls/somecontrol.ascx");

}

protected void Page_Load(object sender, EventArgs e)

{

}

protected void btnAddNew_Click(object sender, EventArgs e)

{

LoadControl("UserControls/somecontrol.ascx");

}


Thanks
Karthik
www.f5Debug.net

Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response