Last post Feb 15, 2012 07:47 AM by Ravi0207
Feb 09, 2012 01:43 PM|Ravi0207|LINK
How to set ascx control height and width, when i place my control in web page its width gets shirnked. i am placing ascx control dynamically
Any suggestion would be appreciated.
Feb 11, 2012 01:30 AM|decker dong - msft|LINK
UserControl doesn't include properties such as "Height" or "Width"；So plz adjust the inner control。Sample if I put a button inside a usercontrol，you should adjust the button's Height and Width——
public partial class Default : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
//Dynamically adding controls……
Control c= LoadControl("MyUserControl.ascx");
(c.FindControl("Button1") as Button).Height = new Unit(300.5);
(c.FindControl("Button1") as Button).Width = new Unit(300.5);
Feb 15, 2012 07:47 AM|Ravi0207|LINK
Thanks much, i will try this and let you know the feedback.