Easy Question ;-) How to render a html page in a table cell of an ASP.NET page

Discussion in 'ASP .Net' started by SteveM, Dec 14, 2006.

  1. SteveM

    SteveM Guest

    I am sure this is an easy question, but being relatively new to ASP.NET
    programming, I can not quite grasp what I need to accomplish what I
    need to do.
    What I have is a word document that is rendered as a page (or actualy a
    part of a page) that is editiable. To do this I let the user download
    the document, edit it and then upload it back to the site. Then at
    Page_Open, I convert the .doc file to an html and render it back to the
    page... that is the way it supposed to work. I am falling down on the
    part on how to render the html back to the cell of table (used for
    formatting) on my ASP.NET page. I can find no controls that allow you
    to display another html page. I have tried putting it into a custom
    control, but then I am faced with scroll bars and it doesnt have the
    look and feel of a normal HTML (sizing by sizing the page).

    So in a nutshell what I want to be able to do is take page a (which is
    an html converted document) and display it in a content section in a
    table cell of a master page... thats all simple huh?

    Thanks for any help or pointers you can give me
    -SteveM
     
    SteveM, Dec 14, 2006
    #1
    1. Advertising

  2. Use an iframe.

    --
    Eliyahu Goldin,
    Software Developer & Consultant
    Microsoft MVP [ASP.NET]


    "SteveM" <> wrote in message
    news:...
    >I am sure this is an easy question, but being relatively new to ASP.NET
    > programming, I can not quite grasp what I need to accomplish what I
    > need to do.
    > What I have is a word document that is rendered as a page (or actualy a
    > part of a page) that is editiable. To do this I let the user download
    > the document, edit it and then upload it back to the site. Then at
    > Page_Open, I convert the .doc file to an html and render it back to the
    > page... that is the way it supposed to work. I am falling down on the
    > part on how to render the html back to the cell of table (used for
    > formatting) on my ASP.NET page. I can find no controls that allow you
    > to display another html page. I have tried putting it into a custom
    > control, but then I am faced with scroll bars and it doesnt have the
    > look and feel of a normal HTML (sizing by sizing the page).
    >
    > So in a nutshell what I want to be able to do is take page a (which is
    > an html converted document) and display it in a content section in a
    > table cell of a master page... thats all simple huh?
    >
    > Thanks for any help or pointers you can give me
    > -SteveM
    >
     
    Eliyahu Goldin, Dec 14, 2006
    #2
    1. Advertising

  3. SteveM

    Steve B. Guest

    Do you have the control of the generated html document ? In other words, is
    it possible to insert into your chain an xml format ...
    Word -> xml -> html in your first app,
    Word -> xml -> table cell inner html in your second app...

    An other solution could be to use the WebClient class.

    WebClient wc = new WebClient();

    string result = wc.DownloadData();

    Regex r = new Regex(@"\<body\>(?<body>.*)\</body\>",
    RegexOptions.IgnoreCase); // not sur of the syntax

    string body = r.Match("result").Group["body"].Value;

    yourTable.Controls.Add(new Literal(body));


    The idea is to capture the body of the remote page using regex, and to
    render the captured content to your page.

    HTH

    "SteveM" <> a écrit dans le message de news:
    ...
    >I am sure this is an easy question, but being relatively new to ASP.NET
    > programming, I can not quite grasp what I need to accomplish what I
    > need to do.
    > What I have is a word document that is rendered as a page (or actualy a
    > part of a page) that is editiable. To do this I let the user download
    > the document, edit it and then upload it back to the site. Then at
    > Page_Open, I convert the .doc file to an html and render it back to the
    > page... that is the way it supposed to work. I am falling down on the
    > part on how to render the html back to the cell of table (used for
    > formatting) on my ASP.NET page. I can find no controls that allow you
    > to display another html page. I have tried putting it into a custom
    > control, but then I am faced with scroll bars and it doesnt have the
    > look and feel of a normal HTML (sizing by sizing the page).
    >
    > So in a nutshell what I want to be able to do is take page a (which is
    > an html converted document) and display it in a content section in a
    > table cell of a master page... thats all simple huh?
    >
    > Thanks for any help or pointers you can give me
    > -SteveM
    >
     
    Steve B., Dec 14, 2006
    #3
  4. SteveM

    SteveM Guest

    Eliyahu,

    I created a custom control based on an IFrame but because it is a frame
    it is bounded and
    requires me to either have scroll bars are determine ahead of time the
    size to make the frame. I could find no where where it would let me
    bind the frame to the side of the cell itself
    and thus make it adjustable as the page grows or shrinks (the way a
    normal HTML page will do). Do you know a way to do this?

    Thanks
    -Steve

    Eliyahu Goldin wrote:
    > Use an iframe.
    >
    > --
    > Eliyahu Goldin,
    > Software Developer & Consultant
    > Microsoft MVP [ASP.NET]
    >
    >
    > "SteveM" <> wrote in message
    > news:...
    > >I am sure this is an easy question, but being relatively new to ASP.NET
    > > programming, I can not quite grasp what I need to accomplish what I
    > > need to do.
    > > What I have is a word document that is rendered as a page (or actualy a
    > > part of a page) that is editiable. To do this I let the user download
    > > the document, edit it and then upload it back to the site. Then at
    > > Page_Open, I convert the .doc file to an html and render it back to the
    > > page... that is the way it supposed to work. I am falling down on the
    > > part on how to render the html back to the cell of table (used for
    > > formatting) on my ASP.NET page. I can find no controls that allow you
    > > to display another html page. I have tried putting it into a custom
    > > control, but then I am faced with scroll bars and it doesnt have the
    > > look and feel of a normal HTML (sizing by sizing the page).
    > >
    > > So in a nutshell what I want to be able to do is take page a (which is
    > > an html converted document) and display it in a content section in a
    > > table cell of a master page... thats all simple huh?
    > >
    > > Thanks for any help or pointers you can give me
    > > -SteveM
    > >
     
    SteveM, Dec 14, 2006
    #4
  5. SteveM

    SteveM Guest

    Steve,
    I use the SaveAs option with a HTML format to convert the Word document
    to HTML
    There is also an XML format, but I fail to see what that buys me?
    (Perhaps I do not fully understand the relationship here or how XML
    renders itself)

    The second solution is something I was toying with, capturing the HTML
    from the page and writing it into my aspx file in the cell location, is
    that what you are getting at?
    I will look up WebClient... I have never used this class before
    Thanks
    -SteveM

    Steve B. wrote:
    > Do you have the control of the generated html document ? In other words, is
    > it possible to insert into your chain an xml format ...
    > Word -> xml -> html in your first app,
    > Word -> xml -> table cell inner html in your second app...
    >
    > An other solution could be to use the WebClient class.
    >
    > WebClient wc = new WebClient();
    >
    > string result = wc.DownloadData();
    >
    > Regex r = new Regex(@"\<body\>(?<body>.*)\</body\>",
    > RegexOptions.IgnoreCase); // not sur of the syntax
    >
    > string body = r.Match("result").Group["body"].Value;
    >
    > yourTable.Controls.Add(new Literal(body));
    >
    >
    > The idea is to capture the body of the remote page using regex, and to
    > render the captured content to your page.
    >
    > HTH
    >
    > "SteveM" <> a écrit dans le message de news:
    > ...
    > >I am sure this is an easy question, but being relatively new to ASP.NET
    > > programming, I can not quite grasp what I need to accomplish what I
    > > need to do.
    > > What I have is a word document that is rendered as a page (or actualy a
    > > part of a page) that is editiable. To do this I let the user download
    > > the document, edit it and then upload it back to the site. Then at
    > > Page_Open, I convert the .doc file to an html and render it back to the
    > > page... that is the way it supposed to work. I am falling down on the
    > > part on how to render the html back to the cell of table (used for
    > > formatting) on my ASP.NET page. I can find no controls that allow you
    > > to display another html page. I have tried putting it into a custom
    > > control, but then I am faced with scroll bars and it doesnt have the
    > > look and feel of a normal HTML (sizing by sizing the page).
    > >
    > > So in a nutshell what I want to be able to do is take page a (which is
    > > an html converted document) and display it in a content section in a
    > > table cell of a master page... thats all simple huh?
    > >
    > > Thanks for any help or pointers you can give me
    > > -SteveM
    > >
     
    SteveM, Dec 14, 2006
    #5
  6. You have to use an iframe, as a whole html page cotnains head. body etc and
    you cant have that in a table cell as it will create invalid html. Also, if
    you try to extract just the body, and features of the page are using
    javascript or CSS injected into the head then you will lose its
    functionality or its style.

    Regards

    John Timney (MVP)
    VISIT MY WEBSITE:
    http://www.johntimney.com
    http://www.johntimney.com/blog


    "SteveM" <> wrote in message
    news:...
    >I am sure this is an easy question, but being relatively new to ASP.NET
    > programming, I can not quite grasp what I need to accomplish what I
    > need to do.
    > What I have is a word document that is rendered as a page (or actualy a
    > part of a page) that is editiable. To do this I let the user download
    > the document, edit it and then upload it back to the site. Then at
    > Page_Open, I convert the .doc file to an html and render it back to the
    > page... that is the way it supposed to work. I am falling down on the
    > part on how to render the html back to the cell of table (used for
    > formatting) on my ASP.NET page. I can find no controls that allow you
    > to display another html page. I have tried putting it into a custom
    > control, but then I am faced with scroll bars and it doesnt have the
    > look and feel of a normal HTML (sizing by sizing the page).
    >
    > So in a nutshell what I want to be able to do is take page a (which is
    > an html converted document) and display it in a content section in a
    > table cell of a master page... thats all simple huh?
    >
    > Thanks for any help or pointers you can give me
    > -SteveM
    >
     
    John Timney \(MVP\), Dec 14, 2006
    #6
  7. SteveM

    SteveM Guest

    John,
    So if I have an IFrame based custom control, I am assuming that I can
    put that in a
    table cell?

    IFrame's are really new to me, do you have any good resources where I
    can see an example at least similiar to what i want to do ( I seem to
    learn by example a lot faster ;-) )

    Thanks
    -Steve

    John Timney (MVP) wrote:
    > You have to use an iframe, as a whole html page cotnains head. body etc and
    > you cant have that in a table cell as it will create invalid html. Also, if
    > you try to extract just the body, and features of the page are using
    > javascript or CSS injected into the head then you will lose its
    > functionality or its style.
    >
    > Regards
    >
    > John Timney (MVP)
    > VISIT MY WEBSITE:
    > http://www.johntimney.com
    > http://www.johntimney.com/blog
    >
    >
    > "SteveM" <> wrote in message
    > news:...
    > >I am sure this is an easy question, but being relatively new to ASP.NET
    > > programming, I can not quite grasp what I need to accomplish what I
    > > need to do.
    > > What I have is a word document that is rendered as a page (or actualy a
    > > part of a page) that is editiable. To do this I let the user download
    > > the document, edit it and then upload it back to the site. Then at
    > > Page_Open, I convert the .doc file to an html and render it back to the
    > > page... that is the way it supposed to work. I am falling down on the
    > > part on how to render the html back to the cell of table (used for
    > > formatting) on my ASP.NET page. I can find no controls that allow you
    > > to display another html page. I have tried putting it into a custom
    > > control, but then I am faced with scroll bars and it doesnt have the
    > > look and feel of a normal HTML (sizing by sizing the page).
    > >
    > > So in a nutshell what I want to be able to do is take page a (which is
    > > an html converted document) and display it in a content section in a
    > > table cell of a master page... thats all simple huh?
    > >
    > > Thanks for any help or pointers you can give me
    > > -SteveM
    > >
     
    SteveM, Dec 14, 2006
    #7
  8. "SteveM" <> wrote in message
    news:...
    > John,
    > So if I have an IFrame based custom control, I am assuming that I can
    > put that in a
    > table cell?


    Dont see why not - you'll need to work out how to style it based on your
    current page dimensions though if you expect it to shrink and grow as your
    page dynamically resizes

    > IFrame's are really new to me, do you have any good resources where I
    > can see an example at least similiar to what i want to do ( I seem to
    > learn by example a lot faster ;-) )


    http://harishmvp.blogspot.com/2005/04/loading-pages-in-iframe-dynamically.html
    --
    Regards

    John Timney (MVP)
    VISIT MY WEBSITE:
    http://www.johntimney.com
    http://www.johntimney.com/blog


    > Thanks
    > -Steve
    >
    > John Timney (MVP) wrote:
    >> You have to use an iframe, as a whole html page cotnains head. body etc
    >> and
    >> you cant have that in a table cell as it will create invalid html. Also,
    >> if
    >> you try to extract just the body, and features of the page are using
    >> javascript or CSS injected into the head then you will lose its
    >> functionality or its style.
    >>
    >> Regards
    >>
    >> John Timney (MVP)
    >> VISIT MY WEBSITE:
    >> http://www.johntimney.com
    >> http://www.johntimney.com/blog
    >>
    >>
    >> "SteveM" <> wrote in message
    >> news:...
    >> >I am sure this is an easy question, but being relatively new to ASP.NET
    >> > programming, I can not quite grasp what I need to accomplish what I
    >> > need to do.
    >> > What I have is a word document that is rendered as a page (or actualy a
    >> > part of a page) that is editiable. To do this I let the user download
    >> > the document, edit it and then upload it back to the site. Then at
    >> > Page_Open, I convert the .doc file to an html and render it back to the
    >> > page... that is the way it supposed to work. I am falling down on the
    >> > part on how to render the html back to the cell of table (used for
    >> > formatting) on my ASP.NET page. I can find no controls that allow you
    >> > to display another html page. I have tried putting it into a custom
    >> > control, but then I am faced with scroll bars and it doesnt have the
    >> > look and feel of a normal HTML (sizing by sizing the page).
    >> >
    >> > So in a nutshell what I want to be able to do is take page a (which is
    >> > an html converted document) and display it in a content section in a
    >> > table cell of a master page... thats all simple huh?
    >> >
    >> > Thanks for any help or pointers you can give me
    >> > -SteveM
    >> >

    >
     
    John Timney \(MVP\), Dec 14, 2006
    #8
    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. Lau Lei Cheong

    Page.Render do not render complete page

    Lau Lei Cheong, May 15, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    2,093
    Lau Lei Cheong
    May 15, 2004
  2. Phillip Roncoroni
    Replies:
    14
    Views:
    1,112
    Toby A Inkster
    Apr 5, 2004
  3. sse
    Replies:
    5
    Views:
    1,308
  4. Glenn Gillen
    Replies:
    0
    Views:
    288
    Glenn Gillen
    Nov 17, 2006
  5. aboycalled3
    Replies:
    5
    Views:
    122
    Michael Winter
    Dec 8, 2004
Loading...

Share This Page