?
Solved

refresh a sub page (reload) using main page

Posted on 2005-05-03
5
Medium Priority
?
382 Views
Last Modified: 2012-06-21
Hi,

Kindly assists how can we reload the whole sub page from the main page, if the sub page is already open, reload, if not open sub page.

Thanks.

The code below doesn't refresh the sub page it only calls it forward..

     Dim strReport As String = ""
     strReport = "cardviewscore.aspx"
     Dim strJS As String = "<script>window.open('" & strReport & "','WindowName','height=300,width=760,left=210,top=300,scrollbars=yes,status=no');<" & "/script>"
     Page.RegisterStartupScript("OpenWindow", strJS)

0
Comment
Question by:EdwardPeter
  • 3
  • 2
5 Comments
 
LVL 23

Accepted Solution

by:
b1xml2 earned 2000 total points
ID: 13919804

Page.RegisterStartUpScript("OpenWindow", _
  String.Format("<script language='javascript'>openWindow('{0}','{1}','{2}');</script>","cardviewscore.aspx","cardview","height=300,width=760,left=210,top=300,scrollbars=yes,status=no"));

<script language="javascript">
function openWindow(url,name,features)
{
      closeWindow();
      win = window.open(url,name,features);
}

function closeWindow()
{
      try
      {
            if (typeof(win) == "object" && win != null)
            {
                  win.close();
            }
      }
      catch (e)
      {
            
      }
}



</script>
0
 
LVL 23

Expert Comment

by:b1xml2
ID: 13919851
if the window is found, close it and then reopen it.. this will cause a refresh...
but if you can avoid a postback, then it will work that is to say, put the script onto a hyperlink control

<asp:HyperLink Id="OpenWindowLink" Runat="server">Open Window</asp:HyperLink>

... and you populate it accordingly
OpenWindowLink.NavigateUrl = String.Format("javascript:openWindow('{0}','{1}','{2}');","cardviewscore.aspx","cardview","height=300,width=760,left=210,top=300,scrollbars=yes,status=no")

That way, rather than a postback causing the popup, the hyperlink opens it... and this will allow the win variable to be recycled.
0
 

Author Comment

by:EdwardPeter
ID: 13919875
b1xml2,

Do we paste that as is ? or we have to place some part in HTML and another in asp code?

Please kindly assist

Thanks.
0
 
LVL 23

Expert Comment

by:b1xml2
ID: 13919912
what action is taken for the sub window to be opened?? is it after a user clicks on something, a postback occurs and the window appears. I need some contextual info from u. Thanks
0
 

Author Comment

by:EdwardPeter
ID: 13919938
b1xml2,


user opens main page and selects a date from the drop down list then the datagrid will be populated. Simultaneously the sub page will be open and the datagrid inside sub page will also be populated.

main page has a datagrid
sub page also has a datagrid

user will select from main page drop down list for a date. then refresh both grids/ open sub grid (if not already open)

Thanks.



0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question