How to auto-refresh a div of webpage

myzgikh

New Member
I am parsing xml of rss feed and displaying it. I want to refresh a div which shows recent news. I am using update panel and asp timer to do this(please refer the below code)but for each refresh entire page is getting refreshed.Can anyone let me know where i am going wrong\[code\]protected void Page_Load(object sender, EventArgs e){ string loggedinuser = "experiment4"; Read_Rss(loggedinuser); var rssFeed = from el in doc.Elements("rss").Elements("channel").Elements("item") orderby datetime(el.Element("pubDate").Value) descending select new { Title = el.Element("title").Value, Link = el.Element("link").Value, Description = replace_other(el.Element("description").Value), // Image = regex(el.Element("description").Value), Image = el.Element(media + "thumbnail") != null ? el.Element(media + "thumbnail").Attribute("url").Value : el.Element(media + "content") != null ? el.Element(media + "content").Attribute("url").Value : regex(el.Element("description").Value) != null ? regex(el.Element("description").Value) : null, PubDate = datetime(el.Element("pubDate").Value), }; lvFeed.DataSource = rssFeed; lvFeed.DataBind(); Data_Load(sender, e);} protected void Data_Load(){ // try //{ string loggedinuser = "experiment4"; Read_Rss(loggedinuser); var rssFeed = from el in doc.Elements("rss").Elements("channel").Elements("item") orderby datetime(el.Element("pubDate").Value) descending select new { Title = el.Element("title").Value, }; newFeed.DataSource = rssFeed; newFeed.DataBind();} <div id="leftcolumn"> <asp:ListView runat="server" ID="lvFeed"> <LayoutTemplate> <ul> <li runat="server" id="itemPlaceHolder"><a></li> </ul> </LayoutTemplate> <ItemTemplate> <div class="box"> <strong> <%#Eval("Title") %> : </strong> <br /> <br /> <img src="http://stackoverflow.com/questions/15776474/<%#Eval("Image")%>" alt="" id="photo" class="photo" onload="imageload(this,0,100)" onerror="onImgError(this,0)"></img> <%#Eval("Description")%><a href="http://stackoverflow.com/questions/15776474/<%#Eval("Link") %>">readmore</a><br /> <br /> <br /> </div> </ItemTemplate> </asp:ListView> </div> <div id='rightcolumn'> <div id='side'> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel2" UpdateMode="Conditional" runat="server"> <ContentTemplate> <asp:Timer ID="Timer2" OnTick="Data_Load" runat="server" Interval="300"> </asp:Timer> <asp:ListView runat="server" ID="newFeed"> <LayoutTemplate> <ul> <li runat="server" id="itemPlaceHolder"><a></li> </ul> </LayoutTemplate> <ItemTemplate> <div class="small"> <%#Eval("Title") %> :<a href="http://stackoverflow.com/questions/15776474/<%#Eval("Link") %>">readmore</a><br /> </div> <br /> </ItemTemplate> </asp:ListView> </ContentTemplate> </asp:UpdatePanel> </div> </div> </div></div>\[/code\]
 
Back
Top