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. add check box to gridview and get the checked rows in gridview to another gridview in c#.net

add check box to gridview and get the checked rows in gridview to another gridview in c#.net

Scheduled Pinned Locked Moved ASP.NET
csharp
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.
  • S Offline
    S Offline
    senpriya
    wrote on last edited by
    #1

    AutoGenerateColumns="false" Font-Bold="true" ForeColor="#003300" OnRowDataBound="gridview1_RowDataBound" Width="186px" OnSelectedIndexChanged="gridview1_SelectedIndexChanged" OnRowCreated="gridview1_RowCreated"> ; InsertVisible="False" ReadOnly="True" SortExpression="Name" > SortExpression="ID" > code behind for getting selected checkbox herere iam not able to get the checked rows.plz find an solution protected void Button1_Click(object sender, EventArgs e) { foreach (GridViewRow row in gridview1.Rows) { DataTable dt=new DataTable(); dt.Columns.Add(new DataColumn("Name", typeof(string))); dt.Columns.Add(new DataColumn("ID", typeof(string))); CheckBox Check = (CheckBox)row.Cells[3].FindControl("chk1"); if (Check.Checked) { dt.Rows.Add(); dt.Rows.Add(row); } } } find a solution to get the checked rows in gridview with regards n.priya

    priya

    S A 2 Replies Last reply
    0
    • S senpriya

      AutoGenerateColumns="false" Font-Bold="true" ForeColor="#003300" OnRowDataBound="gridview1_RowDataBound" Width="186px" OnSelectedIndexChanged="gridview1_SelectedIndexChanged" OnRowCreated="gridview1_RowCreated"> ; InsertVisible="False" ReadOnly="True" SortExpression="Name" > SortExpression="ID" > code behind for getting selected checkbox herere iam not able to get the checked rows.plz find an solution protected void Button1_Click(object sender, EventArgs e) { foreach (GridViewRow row in gridview1.Rows) { DataTable dt=new DataTable(); dt.Columns.Add(new DataColumn("Name", typeof(string))); dt.Columns.Add(new DataColumn("ID", typeof(string))); CheckBox Check = (CheckBox)row.Cells[3].FindControl("chk1"); if (Check.Checked) { dt.Rows.Add(); dt.Rows.Add(row); } } } find a solution to get the checked rows in gridview with regards n.priya

      priya

      S Offline
      S Offline
      sukkureddy
      wrote on last edited by
      #2

      try this, string checkedrows=""+request.Form["CheckboxId"]; if ur checkbox is inside a gridview and it is a Inputype.

      1 Reply Last reply
      0
      • S senpriya

        AutoGenerateColumns="false" Font-Bold="true" ForeColor="#003300" OnRowDataBound="gridview1_RowDataBound" Width="186px" OnSelectedIndexChanged="gridview1_SelectedIndexChanged" OnRowCreated="gridview1_RowCreated"> ; InsertVisible="False" ReadOnly="True" SortExpression="Name" > SortExpression="ID" > code behind for getting selected checkbox herere iam not able to get the checked rows.plz find an solution protected void Button1_Click(object sender, EventArgs e) { foreach (GridViewRow row in gridview1.Rows) { DataTable dt=new DataTable(); dt.Columns.Add(new DataColumn("Name", typeof(string))); dt.Columns.Add(new DataColumn("ID", typeof(string))); CheckBox Check = (CheckBox)row.Cells[3].FindControl("chk1"); if (Check.Checked) { dt.Rows.Add(); dt.Rows.Add(row); } } } find a solution to get the checked rows in gridview with regards n.priya

        priya

        A Offline
        A Offline
        Abhijit Jana
        wrote on last edited by
        #3

        Use GridViewRow , set the selected rows to that new gridview row, now you can use it any other gridview on that page. For any other page use Session . :)

        Best Regards ----------------- Abhijit Jana Check Out My Latest Article Java.NET : Integration of Java and .NET[^] "Success is Journey it's not a destination"

        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