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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Gridview cross page data transfer

Gridview cross page data transfer

Scheduled Pinned Locked Moved ASP.NET
questiondatabase
4 Posts 2 Posters 2 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.
  • S Offline
    S Offline
    srishree
    wrote on last edited by
    #1

    I have a gridview with a link in the parent page.when i click on the link it opens up another gridview.this child gridview has 2 columns,one is a checkbox created using an itemtemplate and another a boundfield retreiving data from the database.what i want is when i check the checkbox of a particular row and hit a button,the data existing in that particular row of the child gridview which has been checked,has to transfer the data from that row to the parent gridview,in a sense the parent gridview has to refresh and show up with the new data that has come from the child gridview control.How can i do this?..........urgent..........

    hi

    K 1 Reply Last reply
    0
    • S srishree

      I have a gridview with a link in the parent page.when i click on the link it opens up another gridview.this child gridview has 2 columns,one is a checkbox created using an itemtemplate and another a boundfield retreiving data from the database.what i want is when i check the checkbox of a particular row and hit a button,the data existing in that particular row of the child gridview which has been checked,has to transfer the data from that row to the parent gridview,in a sense the parent gridview has to refresh and show up with the new data that has come from the child gridview control.How can i do this?..........urgent..........

      hi

      K Offline
      K Offline
      kvPriya
      wrote on last edited by
      #2

      If you want to use pop up window for child gridview, write window.open ("popupwindowname.aspx","mywindow","toolbar=no,scrollbars=yes,resizable=yes,menubar=0,width=700,height=520"); in Parent window design page. And write Session("var1") = gvChild.SelectedDataKey.Value.ToString() Dim scriptSubmit As String = " window.opener.document.forms(0).submit(); " If Not Page.ClientScript.IsClientScriptBlockRegistered(scriptSubmit) Then Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), "script", scriptString) End If Dim ScriptClose As String = " window.close();" Page.ClientScript.RegisterClientScriptBlock(Me.GetType, "Close", ScriptClose) In popup window button click. It will refresh the parent page. In the pageload, with the help of session(“var1”), you can load the new data in the parent gridview. -Priya

      S 1 Reply Last reply
      0
      • K kvPriya

        If you want to use pop up window for child gridview, write window.open ("popupwindowname.aspx","mywindow","toolbar=no,scrollbars=yes,resizable=yes,menubar=0,width=700,height=520"); in Parent window design page. And write Session("var1") = gvChild.SelectedDataKey.Value.ToString() Dim scriptSubmit As String = " window.opener.document.forms(0).submit(); " If Not Page.ClientScript.IsClientScriptBlockRegistered(scriptSubmit) Then Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), "script", scriptString) End If Dim ScriptClose As String = " window.close();" Page.ClientScript.RegisterClientScriptBlock(Me.GetType, "Close", ScriptClose) In popup window button click. It will refresh the parent page. In the pageload, with the help of session(“var1”), you can load the new data in the parent gridview. -Priya

        S Offline
        S Offline
        srishree
        wrote on last edited by
        #3

        Hi Priya,tx,for the reply.can u please give me the solution for the above question using c#.and also i need the page load event for the parent. Many Thanks, Harsha

        hi

        K 1 Reply Last reply
        0
        • S srishree

          Hi Priya,tx,for the reply.can u please give me the solution for the above question using c#.and also i need the page load event for the parent. Many Thanks, Harsha

          hi

          K Offline
          K Offline
          kvPriya
          wrote on last edited by
          #4

          Sure… Hope you understand that window.open(…..); should be written in javascript function which will be called when the user clicks the link of the parent gridview. And in child window , I think, it is better to add an auto generated select button instead of a checkbox, if that doesn’t serve for a special purpose other than to indicate the desired row. Because, it may be ambiguous, if you check multiple checkboxes at a time. If you add select button, the user can select the desired row and click the button. In button click, //assign the primary key value of the selected row into a session variable //For this, you should have assigned the primary key field to the DataKeyNames property //in the design mode(or at codebehind) of the gridview Session(“var1”)=gvChild. SelectedDataKey.Value.ToString(); String scriptSubmit== " window.opener.document.forms(0).submit(); "; If(!Page.ClientScript.IsClientScriptBlockRegistered(scriptSubmit)) Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "script", scriptString); string ScriptClose = " window.close();"; Page.ClientScript.RegisterClientScriptBlock(this.GetType, "Close", ScriptClose); In parent window page load, if(Session(“var1”)!=””) { //do the required using this session variable since this holds the primary key value of the record // I’ve not written the code because I’m not aware of your exact requirement whether insertion or modification) Session(“var1”)=””; 00000//better to clear the session even in the Session_End event of global.asax } Hope this may help you. You are welcome, if you have any queries regarding this. -Vishnu Priya

          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