I am dynamically rendering user control in aspx page. it not rendering evening though the data is binding
public static string LoadUserControl(string controlName)
{
using (Page page = new Page())
{
HtmlForm form = new HtmlForm();
UserControl userControl = (UserControl) page.LoadControl(controlName);
form.Controls.Add(userControl);
using (StringWriter writer = new StringWriter())
{
page.Controls.Add(form);
HttpContext.Current.Server.Execute(page, writer, false);
return writer.ToString();
}
}
}