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. How to pass the checked row from one gridview to another

How to pass the checked row from one gridview to another

Scheduled Pinned Locked Moved ASP.NET
helptutorialquestion
3 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.
  • M Offline
    M Offline
    meeram395
    wrote on last edited by
    #1

    In my form, I have two gridviews. The left one is binded automatically on the click of a button and both the gridviews are having checkboxes. While selecting the checkbox on first row, that row should be added to the right gridview. when clicking on 2nd row checkbox, second should be added and likewise. This is possible on the click of a button. But I don't want a button click. How should I do this on the oncheckchange of the checkbox in gridview? I googled it for sometime, but didn't get much help. Can anybody have any idea please?

    Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.

    A L 2 Replies Last reply
    0
    • M meeram395

      In my form, I have two gridviews. The left one is binded automatically on the click of a button and both the gridviews are having checkboxes. While selecting the checkbox on first row, that row should be added to the right gridview. when clicking on 2nd row checkbox, second should be added and likewise. This is possible on the click of a button. But I don't want a button click. How should I do this on the oncheckchange of the checkbox in gridview? I googled it for sometime, but didn't get much help. Can anybody have any idea please?

      Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.

      A Offline
      A Offline
      adatapost
      wrote on last edited by
      #2

      Basically, GridView and other controls represent the view not data. Data is placed in your simple or complex variables (say objects). It is better practice to work on objects where data is available.

      A DATAPOST COMPUTER CENTRE (K.V Prajapati)

      1 Reply Last reply
      0
      • M meeram395

        In my form, I have two gridviews. The left one is binded automatically on the click of a button and both the gridviews are having checkboxes. While selecting the checkbox on first row, that row should be added to the right gridview. when clicking on 2nd row checkbox, second should be added and likewise. This is possible on the click of a button. But I don't want a button click. How should I do this on the oncheckchange of the checkbox in gridview? I googled it for sometime, but didn't get much help. Can anybody have any idea please?

        Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Add a ASP.NET checkbox in a Template column as below: asp:TemplateField       <ItemTemplate>          <asp:CheckBox   ID="CheckBox1"   runat="server"   AutoPostBack="true" oncheckedchanged="CheckBox1_CheckedChanged" />       </ItemTemplate> </asp:TemplateField> You can get the reference to the GridView row pertaining to the CheckBox clicked using the NamingContainer property    protected void CheckBox1_CheckedChanged(object sender, EventArgs e)       {             CheckBox chk = sender as CheckBox;             GridViewRow gvRow = chk.NamingContainer as GridViewRow;             //You can get the cell values by   gvRow.Cells[1].Text       }

        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