Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I believe you can achieve this without additional JavaScript. What if you build the timing into your web part (using a timer)? You can then expose a Web part property that can allow the end user adjust the refresh interval. If you don't need to adjust the refresh interval, then you don't need to expose the property.Hope this helps. </p> <p>SAMPLE follow this <a href="http://msdn.microsoft.com/en-us/sp2010devtrainingcourse_sharepointdevelopmentwithvisualstudio2010lab_topic6.aspx" rel="nofollow">link</a> to know how to use ajax in Visual Web Parts. then do the following</p> <h2>ASCX MARKUP</h2> <pre><code>&lt;div&gt; &lt;asp:UpdatePanel ID="UpdatePanel1" runat="server"&gt; &lt;ContentTemplate&gt; &lt;asp:ListBox ID="ListBox1" runat="server" Height="177px" Width="269px"&gt;&lt;/asp:ListBox&gt; &lt;/ContentTemplate&gt; &lt;Triggers&gt; &lt;asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" /&gt; &lt;/Triggers&gt; &lt;/asp:UpdatePanel&gt; &lt;asp:Timer ID="Timer1" runat="server" Interval="10000" onprerender="Timer1_PreRender" ontick="Timer1_Tick"&gt; &lt;/asp:Timer&gt; &lt;/div&gt; </code></pre> <h2>ASCX CODE BEHIND</h2> <pre><code>using System; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; namespace vwpTestAjaxRefresh.VisualWebPart1 { public partial class VisualWebPart1UserControl : UserControl { protected void Timer1_Tick(object sender, EventArgs e) { string currenttime = DateTime.Now.ToString("MM/dd/yy H:mm:ss zzz"); ListBox1.Items.Add("Hello World at " + currenttime); } } } </code></pre> <p>Hope this helps.</p>
    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. 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