Note that there are some explanatory texts on larger screens.

plurals
  1. PO"Preview Area" in UpdatePanel not Refreshing
    primarykey
    data
    text
    <p>Greetings!</p> <p>I have a "code builder" page where users select various radio buttons and it generate HTML markup (mostly SCRIPT tags) that they can use on their page to display some data. There is also a "preview" area so they can see the results before they copy/paste the code in their site. The form exists in a FormView control and is wrapped by an UpdatePanel like so:</p> <pre><code>&lt;asp:UpdatePanel ID="UpdatePanel1" runat="server"&gt; &lt;ContentTemplate&gt; &lt;asp:FormView ID="FormView1" runat="server" DataSourceId="XmlDataSource1"&gt; &lt;ItemTemplate&gt; &lt;div id="configArea"&gt; &lt;ul&gt; &lt;li&gt; &lt;%# XPath("Steps/Step1/ServerStatus") %&gt;&lt;br /&gt; &lt;asp:RadioButton ID="RadioButton1" runat="server" GroupName="OneA" Checked="true" AutoPostBack="true" Text='&lt;%# XPath("Steps/Step1/YesOption") %&gt;' /&gt; &lt;asp:RadioButton ID="RadioButton2" runat="server" GroupName="OneA" AutoPostBack="true" Text='&lt;%# XPath("Steps/Step1/NoOption") %&gt;' /&gt; &lt;/li&gt; &lt;li&gt; &lt;%# XPath("Steps/Step1/Uptime") %&gt;&lt;br /&gt; &lt;asp:RadioButton ID="RadioButton3" runat="server" GroupName="OneB" Checked="true" AutoPostBack="true" Text='&lt;%# XPath("Steps/Step1/YesOption") %&gt;' /&gt; &lt;asp:RadioButton ID="RadioButton4" runat="server" GroupName="OneB" AutoPostBack="true" Text='&lt;%# XPath("Steps/Step1/NoOption") %&gt;' /&gt; &lt;/li&gt; &lt;li&gt; &lt;%# XPath("Steps/Step1/IPAddress") %&gt;&lt;br /&gt; &lt;asp:RadioButton ID="RadioButton5" runat="server" GroupName="OneC" Checked="true" AutoPostBack="true" Text='&lt;%# XPath("Steps/Step1/YesOption") %&gt;' /&gt; &lt;asp:RadioButton ID="RadioButton6" runat="server" GroupName="OneC" AutoPostBack="true" Text='&lt;%# XPath("Steps/Step1/NoOption") %&gt;' /&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;div id="copyCode"&gt; &lt;%# XPath("Steps/Step2/CopyPasteCode") %&gt;&lt;br /&gt; &lt;asp:TextBox ID="Textbox1" runat="server" TextMode="MultiLine" Width="300" Height="300" /&gt; &lt;/div&gt; &lt;div id="previewArea"&gt; &lt;%# XPath("Steps/Step3/PreviewTitle") %&gt;&lt;br /&gt; &lt;asp:Literal ID="Literal1" runat="server" /&gt; &lt;/div&gt; &lt;/ItemTemplate&gt; &lt;/asp:FormView&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; &lt;asp:XmlDataSource ID="XmlDataSource1" runat="server" XPath="Root/Data" /&gt; </code></pre> <p>It successfully generates the code in the copycode TextBox (TextBox1), which may look something like this:</p> <pre><code>&lt;script src="http://example.com/src/Constants.js"&gt;&lt;/script&gt; &lt;script&gt; showIPAddress = 0; DisplayServerStatus(); &lt;/script&gt; </code></pre> <p>At the same time, I update the "preview" area's Literal control (Literal1) with the text from the copycode TextBox (TextBox1). The preview is displayed perfectly when not inside an UpdatePanel, but does not work when it is (and I'd prefer to use an UpdatePanel to prevent page refreshing). I do the update of the "preview" area and copycode text during the PreRender event:</p> <pre><code>protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); UpdateCodeSnippetAndPreviewArea(); } </code></pre> <p>Any ideas why the preview doesn't update when it's in an UpdatePanel?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload