Click here to Skip to main content
11,635,626 members (77,700 online)
Rate this: bad
good
Please Sign up or sign in to vote.
Hi all,

I have a single page with a datagrid (on the left hand side) and an iframe (on the right hand side). The datagrid is filled with all vehicles' data from database, while the iframe is filled with a Google map to plot these vehicles.

The iframe actually loads another page to do the plotting.

Issue: I am refreshing the datagrid on timer tick. But, the iframe is not getting refreshed at the same time. So, the map is not getting plotted again with new data. How do I change the iframe src from code behind page on timer tick event?

I have tried the following code on timer tick (code behind) with no effect:

 
 Protected Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs)
      FillGrid()
      createXMLFile()
      iframe1.Attributes("src") = "GmapAll.aspx"      ( not working )
      iframe1.Attributes.Add("src", "GmapAll.aspx")   ( not working )
 End Sub
 

FillGrid() method fills the datagrid. createXMLFile() method creates XML file, and it's path is passed to GmapAll.aspx page (which does the plotting).

Pl help me refresh the iframe on timer tick.

Thanks in advance.
Posted 27-Jul-12 19:48pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi,
Try this:
<iframe height="450px" width="450px" scrolling="auto" runat="server" id="iFrame1" />
protected void Page_Load(object sender, EventArgs e)
{
    string Url = "TXT/business applications_en.htm";
    //iFrame1.Attributes["src"] = Url;
    System.Web.UI.AttributeCollection aCol = iFrame1.Attributes;
    aCol.Add("src", "Test\test.aspx");
}

OR

Try this: add a hidden input field (with runat="server" attribute) and change it's value to your IFrame's src in the JavaScript. That way, you'll be able to read the field's value server-side.

--Amit
  Permalink  
v3
Comments
debo_india at 28-Jul-12 2:09am
   
hi thanks for the answer..i tried this. its not working.
_Amy at 28-Jul-12 2:17am
   
Try my updated answer.
debo_india at 28-Jul-12 2:46am
   
hi i tried both of the above..none are working..
ErBhati at 18-May-13 2:07am
   
Thanks amit
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

ifrmMain.Attributes["src"] = "Your page name";
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 8,861
1 Sergey Alexandrovich Kryukov 8,459
2 Mika Wendelius 6,849
3 F-ES Sitecore 2,354
4 Suvendu Shekhar Giri 2,270


Advertise | Privacy | Mobile
Web04 | 2.8.150728.1 | Last Updated 18 Nov 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100