Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Parsing HTML on aspx page

Thread Tools

Parsing HTML on aspx page

Manmohan Gupta
Posts: n/a
Is there a way to parse the HTML content of an aspx page
into a control object?

I tried this code:

Page pg = new Page();
Control c = pg.ParseControl("<form id=\"Form1\"
method=\"post\" runat=\"server\"></form>");

But it throws an exception:
Object reference not set to an object

Stack Trace:
" at System.Web.UI.BaseParser.MapPath(String path,
Boolean allowCrossAppMapping)\r\n at
System.Web.UI.BaseParser.MapPath(String path)\r\n at
System.Web.UI.TemplateParser.ParseTemplateInternal (String
content, HttpContext context, String baseVirtualDir)\r\n
at System.Web.UI.TemplateParser.ParseTemplate(String
content, HttpContext context, String baseVirtualDir)\r\n
at System.Web.UI.TemplateParser.ParseControl(String
content, HttpContext context, String baseVirtualDir)\r\n
at System.Web.UI.TemplateControl.ParseControl(String
content)\r\n at ConsoleApplication1.Class1.Load3() in
c:\\documents and settings\\mgupta\\my documents\\visual
studio projects\\webapplication21\\consoleapplication1
\\class1.cs:line 34"

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Loading an aspx page in a fram from another aspx page =?Utf-8?B?Uk1M?= ASP .Net 1 09-16-2005 01:21 PM
adding main.aspx.vb & main.aspx.resx under aspx John M ASP .Net 1 05-29-2005 09:27 PM
How to Pass values between from a popup page aspx & a normal page aspx Marco Antonio Montalvo Durán ASP .Net 2 01-23-2004 09:35 PM
include other aspx/html in my aspx page Mr. x ASP .Net 1 11-30-2003 11:56 PM
How do I post data from aspx page to another aspx page. Sriram Mallajyosula ASP .Net 1 11-05-2003 04:48 PM