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. General Programming
  3. C#
  4. Using QueryString

Using QueryString

Scheduled Pinned Locked Moved C#
databasequestion
5 Posts 4 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.
  • F Offline
    F Offline
    Franco Cipriano
    wrote on last edited by
    #1

    I am trying to pass a value from a pop up window back to the parent page. The query string is successful, but it wont go back to the previous page, but instead the pop-up window will redirect to the previous page with the values. What I want to do is close the pop-up window, and go back to the previous page with the values. Here are the code that I currently have: //this is action performed when the button to submit the values are clicked

    protected void btnSelect_Click(object sender, EventArgs e)
    {
    GridViewRow row = grdAll.Rows[SelectedProductIndex];

            name = row.Cells\[2\].Text.ToString();
            Industry = row.Cells\[3\].Text.ToString();
            SubInd = row.Cells\[4\].Text.ToString() ;
            geo = row.Cells\[5\].Text.ToString();
            location = row.Cells\[6\].Text.ToString();
    
            Page.Response.Redirect("frmMain.aspx?name=" + name + "&industry=" + Industry + "&subInd=" + SubInd + "&geo=" + geo + "&location=" + location);
    
        }
    

    //this is the page_load of the parent window

    protected void Page_Load(object sender, EventArgs e)
    {
    if (!IsPostBack)
    {
    if (Page.Request.QueryString["name"] != null)
    {
    txtMPSname.Text = Page.Request.QueryString["name"].ToString();
    txtLoc.Text = Page.Request.QueryString["location"].ToString();
    DlstGeo.Text = Page.Request.QueryString["geo"].ToString();
    DlstInd.Text = Page.Request.QueryString["industry"].ToString();
    DlstSubInd.Text = Page.Request.QueryString["subInd"].ToString();
    }
    }
    }

    T K 2 Replies Last reply
    0
    • F Franco Cipriano

      I am trying to pass a value from a pop up window back to the parent page. The query string is successful, but it wont go back to the previous page, but instead the pop-up window will redirect to the previous page with the values. What I want to do is close the pop-up window, and go back to the previous page with the values. Here are the code that I currently have: //this is action performed when the button to submit the values are clicked

      protected void btnSelect_Click(object sender, EventArgs e)
      {
      GridViewRow row = grdAll.Rows[SelectedProductIndex];

              name = row.Cells\[2\].Text.ToString();
              Industry = row.Cells\[3\].Text.ToString();
              SubInd = row.Cells\[4\].Text.ToString() ;
              geo = row.Cells\[5\].Text.ToString();
              location = row.Cells\[6\].Text.ToString();
      
              Page.Response.Redirect("frmMain.aspx?name=" + name + "&industry=" + Industry + "&subInd=" + SubInd + "&geo=" + geo + "&location=" + location);
      
          }
      

      //this is the page_load of the parent window

      protected void Page_Load(object sender, EventArgs e)
      {
      if (!IsPostBack)
      {
      if (Page.Request.QueryString["name"] != null)
      {
      txtMPSname.Text = Page.Request.QueryString["name"].ToString();
      txtLoc.Text = Page.Request.QueryString["location"].ToString();
      DlstGeo.Text = Page.Request.QueryString["geo"].ToString();
      DlstInd.Text = Page.Request.QueryString["industry"].ToString();
      DlstSubInd.Text = Page.Request.QueryString["subInd"].ToString();
      }
      }
      }

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

      I THINK U SHOULD TRY THIS :-O U SHOULD CREATE A BUTTON INSIDE THE POP-UP PAGE NAMED "BACK", THEN GIVE IT THIS CODE: Form1 frm2 = new Form1(); this.Hide(); frm2.Show(); frm2.Region = this.Region;

      1 Reply Last reply
      0
      • F Franco Cipriano

        I am trying to pass a value from a pop up window back to the parent page. The query string is successful, but it wont go back to the previous page, but instead the pop-up window will redirect to the previous page with the values. What I want to do is close the pop-up window, and go back to the previous page with the values. Here are the code that I currently have: //this is action performed when the button to submit the values are clicked

        protected void btnSelect_Click(object sender, EventArgs e)
        {
        GridViewRow row = grdAll.Rows[SelectedProductIndex];

                name = row.Cells\[2\].Text.ToString();
                Industry = row.Cells\[3\].Text.ToString();
                SubInd = row.Cells\[4\].Text.ToString() ;
                geo = row.Cells\[5\].Text.ToString();
                location = row.Cells\[6\].Text.ToString();
        
                Page.Response.Redirect("frmMain.aspx?name=" + name + "&industry=" + Industry + "&subInd=" + SubInd + "&geo=" + geo + "&location=" + location);
        
            }
        

        //this is the page_load of the parent window

        protected void Page_Load(object sender, EventArgs e)
        {
        if (!IsPostBack)
        {
        if (Page.Request.QueryString["name"] != null)
        {
        txtMPSname.Text = Page.Request.QueryString["name"].ToString();
        txtLoc.Text = Page.Request.QueryString["location"].ToString();
        DlstGeo.Text = Page.Request.QueryString["geo"].ToString();
        DlstInd.Text = Page.Request.QueryString["industry"].ToString();
        DlstSubInd.Text = Page.Request.QueryString["subInd"].ToString();
        }
        }
        }

        K Offline
        K Offline
        Karthik Harve
        wrote on last edited by
        #3

        Hi, Instead of "Response.Redirect()" use the javascript function like this.

        function closeFrm(val1,val2,val3,val4,val5)
        {
        self.close();
        window.opener.location.href = "frmMaain.aspx?name=val1&location=val2&geo=val3&industry=val4&subInd=val5";
        }

        and call this function through code as below.

        ScriptManager.RegisterClientSciptBlock(this,this.GetType(),"Myscript","closeFrm('"+ name +"','"+ location +"','"+ geo +"','"+ Industry +"','"+ SubInd +"'");

        Hope it works.

        with regards Karthik Harve

        F 1 Reply Last reply
        0
        • K Karthik Harve

          Hi, Instead of "Response.Redirect()" use the javascript function like this.

          function closeFrm(val1,val2,val3,val4,val5)
          {
          self.close();
          window.opener.location.href = "frmMaain.aspx?name=val1&location=val2&geo=val3&industry=val4&subInd=val5";
          }

          and call this function through code as below.

          ScriptManager.RegisterClientSciptBlock(this,this.GetType(),"Myscript","closeFrm('"+ name +"','"+ location +"','"+ geo +"','"+ Industry +"','"+ SubInd +"'");

          Hope it works.

          with regards Karthik Harve

          F Offline
          F Offline
          Franco Cipriano
          wrote on last edited by
          #4

          I'm getting an error :

          Error 1 'System.Web.UI.ScriptManager' does not contain a definition for 'RegisterClientSciptBlock'

          on this line

          ScriptManager.RegisterClientSciptBlock

          thanks,

          R 1 Reply Last reply
          0
          • F Franco Cipriano

            I'm getting an error :

            Error 1 'System.Web.UI.ScriptManager' does not contain a definition for 'RegisterClientSciptBlock'

            on this line

            ScriptManager.RegisterClientSciptBlock

            thanks,

            R Offline
            R Offline
            Ravi Bhavnani
            wrote on last edited by
            #5

            That's a typo.  Obviously he meant:

            ScriptManager.RegisterClientScriptBlock

            /ravi

            My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

            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