[CLOSED] Rendering html in a user control

  1. #1

    [CLOSED] Rendering html in a user control

    Hi there,

    I have a method the returns a partial view result to a user control which decodes some html for display:

    Controller:

    public ActionResult ViewNote(string id, string organizationName, string timePeriodId)
    {
           var pr = new Ext.Net.MVC.PartialViewResult();
           pr.SingleControl = true;
           pr.WrapByScriptTag = false;
    
           ....
    
           return pr;
    }
    User Control:

    
    <ext:Panel runat="server" ID="ViewNotes" ClientIDMode="Static" AutoDataBind="true" Hidden="true">
        <Content>
            <div class="formseperator">
                <%= Html.Raw(HttpUtility.HtmlDecode(item.Note))%>
            </div>
        </Content>
    </ext:Panel>
    I found that in the user control some html elements (ordered lists for example) did not display correctly while others (like bold) displayed fine. I did an experiment loading content into a regular mvc view page and found that if I set the Ext ResourceManager like so:

    <ext:ResourceManager ID="ResourceManager" RenderStyles="None" runat="server" />
    Then the decoded html would render correctly, however, I'm not sure why.

    Is there something I can do in the user control to properly render the decoded html like I was able to render it in the view?

    Thanks for any suggestions.
    Last edited by Daniil; Mar 14, 2012 at 8:31 PM. Reason: [CLOSED]
  2. #2
  3. #3
    Thanks for your reply Daniil.

    I set PreventbodyReset="true" on my Panel but still have the formatted html in my output. This may be something I'm doing as I get the innerHTML of the Panel for use elsewhere:

    var win = Ext.getCmp("ViewNotes");
    var html = win.getBody().dom.innerHTML.trim();
    Thank you.
  4. #4
    Could you provide a sample to reproduce the problem?
  5. #5
    Hi Daniil,

    I was able to solve the issue by rendering the content into an iframe. Thanks for your help.

Similar Threads

  1. Replies: 2
    Last Post: Feb 06, 2012, 9:06 AM
  2. how to upload user control dynamicaly on user control
    By archana mahadule in forum 1.x Help
    Replies: 1
    Last Post: Jan 13, 2011, 12:05 PM
  3. [CLOSED] Script tag HTML rendering on first page load
    By seanwo in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Aug 03, 2010, 8:31 PM
  4. Replies: 1
    Last Post: May 28, 2010, 1:13 PM
  5. Replies: 2
    Last Post: Apr 15, 2010, 5:33 AM

Tags for this Thread

Posting Permissions