problem getting html in framework 2.0

Last post 06-06-2007 10:27 PM by Jessica Cao - MSFT. 1 replies.

Sort Posts:

  • problem getting html in framework 2.0

    06-06-2007, 10:36 AM
    • Member
      26 point Member
    • laguna
    • Member since 06-06-2007, 2:26 PM
    • Posts 4

    Hi, i had a function GetHTML in the framework 1.1

    public static string GetHTML(Control ctrl)

    {

    StringBuilder MiStringBuilder = new StringBuilder();

    StringWriter MiStringWriter = new StringWriter(MiStringBuilder);

    HtmlTextWriter MiHTMLTextWriter = new HtmlTextWriter(MiStringWriter);

    ctrl.RenderControl(MiHTMLTextWriter);

    return MiStringBuilder.ToString();

    }

    I needed to move to framework 2.0 and i had to change the function like this:

     

    public static string GetHTML(Control ctrl)

    {

    StringBuilder sb = new StringBuilder();

    StringWriter sw = new StringWriter(sb);

    HtmlTextWriter htw = new HtmlTextWriter(sw);

    Page page = new PageBase();

    page.EnableEventValidation = false;

    ctrl.Page = page;

    ctrl.RenderControl(htw);

    return sw.ToString();

    }

    when PageBase is a class that has the method "VerifyRenderingInServerForm" overrided.

     

    My problem is: when converting a datagrid, the old version fired the itemcreated and the itemdatabound events, the NEW version doesn't!!!!! Can anyone help me with this function?!?!?!

     

    Thanks!!

    Laguna.

  • Re: problem getting html in framework 2.0

    06-06-2007, 10:27 PM

    Hello Laguna,

    What do you mean by "the old version fired the itemcreated and the itemdatabound events"?

    Thank you,

    Jessica

    Jessica Cao
    Sincerely,
    Microsoft Online Community Support


    “Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”
Page 1 of 1 (2 items)