Select Multiple Records on GridView

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • code4knowledge
    New Member
    • Feb 2008
    • 3

    Select Multiple Records on GridView

    Hi!

    Is there a way to have a user select more than one record from a gridview?

    Thanks to all for the helping hand!!!!

    code4knowledge! !!
  • gayathriram
    New Member
    • Feb 2008
    • 6

    #2
    string connection = " Data Source=SERVER;I nitial Catalog=databas ename;User ID=; Password=;";
    SqlConnection con = new SqlConnection(c onnection);
    string query1 = "select * from table1";
    SqlCommand cmd1 = new SqlCommand(quer y1, con);
    SqlDataAdapter adap = new SqlDataAdapter( cmd1);
    DataSet ds = new DataSet();
    con.Open();
    adap.Fill(ds);
    GridView1.DataS ource = ds;
    GridView1.DataB ind();
    con.Close();


    While clicking some button event you write this code means you can get

    a single and multiple rows from table to data grid.

    In the above code insert your databasename,se rvername,user id and password and tablename,contr ol name and all.

    Try this will come output definitely

    Comment

    • code4knowledge
      New Member
      • Feb 2008
      • 3

      #3
      Hi Gayathriram,

      Thank you for your response, that works well. However, I may have mis interpreted what I am trying to accomplish. I need to copy the selected records from a grid view into another grid view that will allow the users to edit the data and insert as new records.

      By the way, I am using C# VS2005.

      Thank you!

      Comment

      Working...