plz help me, create and post form on runtime
-
How can I create a form at runtime and submit it in code behind, all the below code is created on runtime and submitted too in test.aspx. how can i achieve that.
:rose:Dear Friend, Try this Code into your some button click from where you want to create new aspx page. Some BUTTON_CLICK(sender,event) { StreamWriter sw=new StreamWriter(Server.MapPath("PTells.aspx")); StringBuilder sb = new StringBuilder(); sb.AppendLine("<%@ Page Language='C#' %>"); sb.AppendLine("<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>"); sb.AppendLine("<script runat='server'>"); sb.AppendLine("</script>"); sb.AppendLine("<html xmlns='http://www.w3.org/1999/xhtml'>"); sb.AppendLine("<head runat='server'><title>Untitled Page</title></head><body>"); sb.AppendLine("<form id='form1' runat='server'><div>"); sb.AppendLine("<div><asp:TextBox ID='TextBox1' runat='server'></asp:TextBox>"); sb.AppendLine("<asp:Button ID='Button1' runat='server' Text='Button'/></div></div></form></body></html>"); sw.Write(sb.ToString()); sw.Close(); Response.Redirect("PTells.aspx"); } I hope this will helps you. Thanks :laugh:
"Good Thing Goes With Good People..."