Answered by:
Add <html> tag <form> tag in ASPX page dynamically.

Question
-
I have the aspx page which doesnot have any <html> tags.
This page only contains this line
<%
@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
I want to add <html> tag < form> tag dynamically in aspx page through codebehind file such as .cs.
The password must contain a minimum of one lower case character, one upper case character, and one d- Moved by OmegaMan Sunday, September 7, 2008 2:41 AM ASP.Net question (Moved from Regular Expressions to Off-Topic Posts (Do Not Post Here))
Friday, July 4, 2008 10:18 AM
Answers
-
Hi
You can do that. You can add html tag on aspx dynamicaly .
ASPX page.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DynamicAspx.aspx.cs" Inherits="DynamicAspx" %>
<%Response.Write(str.ToString());%>
ASPX.CS Page.
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Text;
public partial class DynamicAspx : System.Web.UI.Page
{
public StringBuilder str = new StringBuilder();
protected void Page_Load(object sender, EventArgs e)
{
str.Append(@"<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat='server'>
<title>Untitled Page</title>
</head>
<body>
<form id='form1' runat='server'>
<div>
Hello World;
</div>
</form>
</body>
</html>");
}
}
now you will get the out put 'hello world.'
- Proposed as answer by MaheshBargeIndia Friday, July 4, 2008 3:14 PM
- Marked as answer by Ed Price - MSFTMicrosoft employee Saturday, December 8, 2012 12:42 AM
Friday, July 4, 2008 3:13 PM -
You can ask ASP.NET questions at http://asp.net/forums
Thanks!
Ed Price (a.k.a User Ed), SQL Server Customer Program Manager (Blog, Twitter, Wiki)
- Marked as answer by Ed Price - MSFTMicrosoft employee Saturday, December 8, 2012 12:51 AM
Saturday, December 8, 2012 12:51 AM
All replies
-
Hi
You can do that. You can add html tag on aspx dynamicaly .
ASPX page.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DynamicAspx.aspx.cs" Inherits="DynamicAspx" %>
<%Response.Write(str.ToString());%>
ASPX.CS Page.
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Text;
public partial class DynamicAspx : System.Web.UI.Page
{
public StringBuilder str = new StringBuilder();
protected void Page_Load(object sender, EventArgs e)
{
str.Append(@"<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat='server'>
<title>Untitled Page</title>
</head>
<body>
<form id='form1' runat='server'>
<div>
Hello World;
</div>
</form>
</body>
</html>");
}
}
now you will get the out put 'hello world.'
- Proposed as answer by MaheshBargeIndia Friday, July 4, 2008 3:14 PM
- Marked as answer by Ed Price - MSFTMicrosoft employee Saturday, December 8, 2012 12:42 AM
Friday, July 4, 2008 3:13 PM -
this is great work.
Can we also do same thing in Page_Init event to create dynamic controls as html
The password must contain a minimum of one lower case character, one upper case character, and one dMonday, July 7, 2008 9:21 AM -
You can ask ASP.NET questions at http://asp.net/forums
Thanks!
Ed Price (a.k.a User Ed), SQL Server Customer Program Manager (Blog, Twitter, Wiki)
- Marked as answer by Ed Price - MSFTMicrosoft employee Saturday, December 8, 2012 12:51 AM
Saturday, December 8, 2012 12:51 AM