[CLOSED] Get html out of a ext:panel

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] Get html out of a ext:panel



    Hi
    I hava a ext:panel that I insert html in to from the code behind, like this:
    pnlTest.SetHtml("<html></html>");
    In javascript I can get this html with this code:
    var html = pnlTest.body.dom.innerHTML;
    How do I do this in the code behind in .NET?

    /Mikael
  2. #2

    RE: [CLOSED] Get html out of a ext:panel

    Hi Mikael,

    I think before the submit the Page, you would have to get the body.dom.innerHTML and add that string into a hidden input field. You might also have to encode the html before adding it to the field. If the input field contains "html", I think asp.net will complain during the postback.


    Hope this helps.


    Geoffrey McGill
    Founder
  3. #3

    RE: [CLOSED] Get html out of a ext:panel

    Can you show me in a couple of lines, how you mean. You mean that I sould set the value in a hidden field from the javascript, on a handler event? And how do I encode it?



    
    
    
    
    function SetInnerHTML()
    {
        hfInnerHTML.setValue(pnlTest.body.dom.innerHTML);
    }
    
    
    
    <ext:Hidden ID="hfInnerHTML" runat="server"></ext:Hidden>
    
    <Button>
    <Listeners><Click Handler="SetInnerHTML()" /></Listeners>
    </Button>
    /Mikael
  4. #4

    RE: [CLOSED] Get html out of a ext:panel

    Ok
    I got it to work, but it fails when I set the value to HTML, but works if I just write a word.

    How do I encode it?

    /Mikael
  5. #5

    RE: [CLOSED] Get html out of a ext:panel

    Hi Mikael,

    You could use the Ext.util.Format.htmEncode function.


    Example


    Ext.util.Format.htmlEncode("<test>")

    See also,


    http://extjs.com/deploy/dev/docs/?cl...ber=htmlEncode



    Geoffrey McGill
    Founder
  6. #6

    RE: [CLOSED] Get html out of a ext:panel

    Excellent, how do I decode it. To be able to show the html again?

    /Mikael
  7. #7

    RE: [CLOSED] Get html out of a ext:panel

    The htmlDecode function will decode the string back into html, see*http://extjs.com/deploy/dev/docs/?cl...ber=htmlDecode

    Geoffrey McGill
    Founder
  8. #8

    RE: [CLOSED] Get html out of a ext:panel

    But I need the html in the code behind? not in javascript? How do I call it from .NET?

    /Mikael
  9. #9

    RE: [CLOSED] Get html out of a ext:panel

    Hi Mikael,

    I'm not sure I understand what you asking. Once you add the encoded html into the hidden field it should be submitted to the server? Once submitted, then you just have to get the value from the hidden field, which will be the encoded html string.*


    Maybe you should explain the whole scenario, which would give us a better picture as to work off of.*


    Geoffrey McGill
    Founder
  10. #10

    RE: [CLOSED] Get html out of a ext:panel

    I get the HTML from the server like this:

    string strInnerHTML = hfInnerHTML.Value.ToString();
    But the html is still encoded, when I try to show it in the browser again, it just prints out html (the actual code, not interpreted). I need it to be decoded on the server.

    The senario is the same, all I want to do i get the innerHTML out of a panel from the server side. And im almost there, I just need to decode the encoded HTML
    /Mikael
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 1
    Last Post: Apr 11, 2012, 4:24 PM
  2. [CLOSED] Ext control in html tag of the panel.
    By stoque in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 12, 2011, 1:30 AM
  3. [CLOSED] [1.0] Panel .html
    By state in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: May 17, 2010, 6:00 PM
  4. [CLOSED] panel content as html
    By alexp in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: May 01, 2009, 6:53 AM
  5. [CLOSED] Setting Html panel to 100%
    By speedstepmem2 in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jan 07, 2009, 3:15 AM

Posting Permissions