Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Ok then you can easily use Asp.net provided update panel which is based on Ajax.</p> <p>javascript code: trigger update repeatedly, put this inside head section</p> <pre><code>&lt;script type="text/javascript" language="javascript"&gt; function worker() { __doPostBack('&lt;%=updateComments.ClientID %&gt;', null); setTimeout(worker, 5000); // 5000= 5 seconds i.e section will get refereshed in intervals of 5 second } &lt;/script&gt; </code></pre> <p>Markup: Enclose the section to be updated Asynchronously in Update panel. you will also have to place the script manager in your code as below.</p> <pre><code>&lt;asp:ScriptManager ID="manager" runat="server" &gt;&lt;/asp:ScriptManager&gt; &lt;asp:UpdatePanel ID="updateComments" runat="server"&gt; &lt;ContentTemplate&gt; &lt;div id="divConversation" style="width: 100%;"&gt; &lt;div style='background-color: ALICEBLUE; float: left; width: 100%; word-wrap: break-word; font-size: 14px;'&gt; &lt;pre&gt;&lt;font color='green'&gt;&lt;b&gt; &lt;div style='background-color: ALICEBLUE; margin-right: 410px;'&gt; &lt;asp:Literal ID="ltrlFirst" runat="server"&gt;&lt;/asp:Literal&gt; Says: &lt;/b&gt;&lt;/font&gt;&lt;/pre&gt; &lt;/div&gt; &lt;div style='background-color: ALICEBLUE; font-size: 14px; float: left; width: 410px; margin-left: -410px; word-wrap: break-word; font-size: 14px;'&gt; &lt;pre&gt;&lt;font&gt; &lt;asp:Literal ID="ltrlSecond" runat="server"&gt;&lt;/asp:Literal&gt; &lt;/font&gt;&lt;/pre&gt; &lt;/div&gt; &lt;div style='background-color: ALICEBLUE; word-wrap: break-word;'&gt; &lt;p style='color: #8B8A8A; margin-top: 0'&gt; Sent at &lt;asp:Literal ID="ltrlThird" runat="server"&gt;&lt;/asp:Literal&gt; &lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; </code></pre> <p>Also make sure that the literal is data bounded outside this i.e it should be data bounded on every postback not just first.</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { } BindCommentData(); // New method which binds data. } Private void BindCommentData() { // Here you get the dt.. if(dt.Rows.Count != 0) { ltrlFirst.Text = dt.Rows[i][2].ToString(); ltrlSecond.Text = dt.Rows[i][0].ToString(); ltrlThird.Text = Convert.ToDateTime(dt.Rows[i][1]).ToLongTimeString(); } } </code></pre>
    singulars
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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