Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Refreshing a page when action takes place on another page

Refreshing a page when action takes place on another page

Scheduled Pinned Locked Moved ASP.NET
databasedesigntutorialquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    viktor9990
    wrote on last edited by
    #1

    I have 2 pages (Presentations.aspx.cs) and (CustomerSlides.aspx.cs). I have url paths in my database which show different pages on (Presentations.aspx.cs) when clicking in a meny on the same page. These pages will be also shown at the same time on (CustomerSlides.aspx.cs) every time I click in the men in (Presentations.aspx.cs). The url paths in the first Page are saved in an application object (application["fullpath"]) and retrieved in the second page. See my code below. I want the second page to refresh every time I click on a different link in the (Presentations.aspx.cs) menu so that I can see the same url in (CustomerSlides.aspx.cs). How to do that? Maybe the solution is from global.asax. Thanks in advance Here is Presentations.aspx.cs: private void Page_Load(object sender, System.EventArgs e) { if ((Request.Params["SlideID"] != string.Empty) & (Request.Params["SlideID"] != null)) { //Get the SlideID int slideID; slideID = int.Parse(Request.Params["SlideID"]); //Create an instans of PresentationDB PresentationDB url = new PresentationDB(); SqlDataReader dr = url.GetSlide(slideID); dr.Read(); string fullPath; fullPath = dr.GetString(0); //This is needed for the database path info // string overflowPath = "c:\inetpub\wwwroot"; // string exactPath = fullPath.Replace(overflowPath, string.Empty); //Save the fullPath in a Session, this value will be retrieved for use in (CustomerSlides.aspx.cs) Application["fullPath"] = fullPath; //Find the mainIframe control and add a source attribute to it HtmlControl mainIframe = (HtmlControl)this.FindControl("menuForm").FindControl("mainIframe"); mainIframe.Attributes["src"] = fullPath; } else { HtmlControl mainIframe = (HtmlControl)this.FindControl("menuForm").FindControl("mainIframe"); mainIframe.Attributes["src"] = "Main.aspx"; } } Here is CustomerSlides.aspx.cs: public class CustomerSlides : System.Web.UI.Page { protected System.Web.UI.WebControls.Label Message; protected System.Web.UI.HtmlControls.HtmlGenericControl mainIframe; private void Page_Load(object sender, System.Event

    T 1 Reply Last reply
    0
    • V viktor9990

      I have 2 pages (Presentations.aspx.cs) and (CustomerSlides.aspx.cs). I have url paths in my database which show different pages on (Presentations.aspx.cs) when clicking in a meny on the same page. These pages will be also shown at the same time on (CustomerSlides.aspx.cs) every time I click in the men in (Presentations.aspx.cs). The url paths in the first Page are saved in an application object (application["fullpath"]) and retrieved in the second page. See my code below. I want the second page to refresh every time I click on a different link in the (Presentations.aspx.cs) menu so that I can see the same url in (CustomerSlides.aspx.cs). How to do that? Maybe the solution is from global.asax. Thanks in advance Here is Presentations.aspx.cs: private void Page_Load(object sender, System.EventArgs e) { if ((Request.Params["SlideID"] != string.Empty) & (Request.Params["SlideID"] != null)) { //Get the SlideID int slideID; slideID = int.Parse(Request.Params["SlideID"]); //Create an instans of PresentationDB PresentationDB url = new PresentationDB(); SqlDataReader dr = url.GetSlide(slideID); dr.Read(); string fullPath; fullPath = dr.GetString(0); //This is needed for the database path info // string overflowPath = "c:\inetpub\wwwroot"; // string exactPath = fullPath.Replace(overflowPath, string.Empty); //Save the fullPath in a Session, this value will be retrieved for use in (CustomerSlides.aspx.cs) Application["fullPath"] = fullPath; //Find the mainIframe control and add a source attribute to it HtmlControl mainIframe = (HtmlControl)this.FindControl("menuForm").FindControl("mainIframe"); mainIframe.Attributes["src"] = fullPath; } else { HtmlControl mainIframe = (HtmlControl)this.FindControl("menuForm").FindControl("mainIframe"); mainIframe.Attributes["src"] = "Main.aspx"; } } Here is CustomerSlides.aspx.cs: public class CustomerSlides : System.Web.UI.Page { protected System.Web.UI.WebControls.Label Message; protected System.Web.UI.HtmlControls.HtmlGenericControl mainIframe; private void Page_Load(object sender, System.Event

      T Offline
      T Offline
      tojamismis
      wrote on last edited by
      #2

      Nope... you need to control the user's browser so this can only be done on the client side. Take a look at this javascript. http://forums.devshed.com/t53270/s.html[^] Torin Blair
      'In the immortal words of Socrates - "I drank what?".'

      V 1 Reply Last reply
      0
      • T tojamismis

        Nope... you need to control the user's browser so this can only be done on the client side. Take a look at this javascript. http://forums.devshed.com/t53270/s.html[^] Torin Blair
        'In the immortal words of Socrates - "I drank what?".'

        V Offline
        V Offline
        viktor9990
        wrote on last edited by
        #3

        I tried now with client script but it is not working. It does not recognise win2 (which contains the other page, "CustomerSlide.aspx") Which I want to reload by clicking on a link from Presentation.aspx. See my code below. I'm getting this error message: location is null or not an object. Feel free to edit in my code.Thanks. <%@ Page language="c#" Codebehind="Presentations.aspx.cs" AutoEventWireup="false" Inherits="Presentations" %> <%@ Register TagPrefix="LAIKAMENU" TagName="Menu" Src="_Menu.ascx" %> Presentations var win2; function change(href){ win2.location.href = href; } var win2; function change(href){ win2.location.href = href; } function reloadwin2(){ var win2; win2.location.href = "CustomerSlides.aspx"; win2.location.reload(); }

        Uppdate Customer page

        J 1 Reply Last reply
        0
        • V viktor9990

          I tried now with client script but it is not working. It does not recognise win2 (which contains the other page, "CustomerSlide.aspx") Which I want to reload by clicking on a link from Presentation.aspx. See my code below. I'm getting this error message: location is null or not an object. Feel free to edit in my code.Thanks. <%@ Page language="c#" Codebehind="Presentations.aspx.cs" AutoEventWireup="false" Inherits="Presentations" %> <%@ Register TagPrefix="LAIKAMENU" TagName="Menu" Src="_Menu.ascx" %> Presentations var win2; function change(href){ win2.location.href = href; } var win2; function change(href){ win2.location.href = href; } function reloadwin2(){ var win2; win2.location.href = "CustomerSlides.aspx"; win2.location.reload(); }

          Uppdate Customer page

          J Offline
          J Offline
          Jesse Squire
          wrote on last edited by
          #4

          It appears that you've defined the variable win2 several times, both as a global and local variable. This is going to cause inconsistent results, the global instance of win2 will be hidden by the local instance for those functions where it is defined. I'd recommend that you alter the javascript, perhapse something like:var win2; function Change(newHref) { win2.location.href = newHref; } function ReloadWin2() { win2.reload(); }
          Also, why are you setting the location in the reloadwin2 function? Shouldn't that function just reload the page being displayed [as written above]? Hope that helps. :) --Jesse

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups