Parsing HTML on aspx page

Discussion in 'ASP .Net Web Controls' started by Manmohan Gupta, Jan 9, 2004.

  1. 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"
    Manmohan Gupta, Jan 9, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sriram Mallajyosula

    How do I post data from aspx page to another aspx page.

    Sriram Mallajyosula, Nov 5, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    951
    Steve C. Orr [MVP, MCSD]
    Nov 5, 2003
  2. Mr. x
    Replies:
    1
    Views:
    1,947
    John Timney \(Microsoft MVP\)
    Nov 30, 2003
  3. Marco Antonio Montalvo Durán
    Replies:
    2
    Views:
    4,072
    Matt Morris
    Jan 23, 2004
  4. John M
    Replies:
    1
    Views:
    1,101
    Kumar Reddi
    May 29, 2005
  5. =?Utf-8?B?Uk1M?=
    Replies:
    1
    Views:
    535
    =?Utf-8?B?QW5keSBMdWtzaWM=?=
    Sep 16, 2005
Loading...

Share This Page