Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Updating contents in a custom webpart in a Discussion Board topic page

$
0
0

Hi

I have made a custom Visual Webpart. I'm wanting to periodically update a label in the webpart without refreshing the whole page. I've got the label to update, however it is also updating the replies on the page that I've placed the webpart. The page I'm wanting to use it is in a Discussion Board on the Topic pages that contain the topic and all replies.

In my ascx file I have

<asp:UpdatePanel ID="UpdatePanel2" UpdateMode="Conditional" runat="server"><Triggers><asp:AsyncPostBackTrigger  ControlID="Timer1" EventName="Tick" /></Triggers><ContentTemplate><asp:Label ID="LabelRefreshNotice" runat="server" Text="not refreshed yet."></asp:Label><br /><br /></ContentTemplate></asp:UpdatePanel><asp:Timer ID="Timer1" OnTick="Timer1_Tick" runat="server" Interval="10000" />

And in my ascx.cs file

protected void Timer1_Tick(object sender, EventArgs e)
        {
            LabelRefreshNotice.Text = "Refreshed at: " + DateTime.Now.ToLongTimeString();
        }

This updates the label like I want, but also updates all the replies and clears any text I have written in the reply box, which I don't want. How can I get it to update only the specific content in the web part?

Thanks


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>