473,385 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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!!!
Feb 19 '08 #1
2 986
string connection = " Data Source=SERVER;Initial Catalog=databasename;User ID=; Password=;";
SqlConnection con = new SqlConnection(connection);
string query1 = "select * from table1";
SqlCommand cmd1 = new SqlCommand(query1, con);
SqlDataAdapter adap = new SqlDataAdapter(cmd1);
DataSet ds = new DataSet();
con.Open();
adap.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
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,servername,user id and password and tablename,control name and all.

Try this will come output definitely
Feb 20 '08 #2
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!
Feb 20 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Mohammed Mazid | last post by:
Hi folks! Can anyone please help me with this? I am developing a Quiz program but I am stuck with "multiple answers". Basically I need some sort of code that would select multiple answers...
4
by: MasterChief | last post by:
I have a customer that likes the gridview but instead of using the standard Delete command for each row he wants to be able to put a checkbox next to the row so he can chose multiple records and...
0
by: DXJas | last post by:
If I have a gridview control in a web page and it has multiple pages of records. How do I allow the user to print the multiple pages? -- Jas
6
by: Terry | last post by:
Good morning! How do I determine which SELECT button was clicked in a GridView? The multiple SELECT buttons will be used for an application approval process. Thank you in advance for your...
1
by: K B | last post by:
Hi. I have a gridview with sqldatasource, etc. For the grid, I also have a search textbox. If the user needs to filter the records, I want to dynamically adjust the SELECT statement for the...
1
by: Mr. SweatyFinger | last post by:
I have a gridview and a sqlserver datasource. I also have a dropdownlist of countries. The gridview displays a bunch of crap about whatever country is selected in the countries dropdownlist I...
0
by: New2ASP | last post by:
Thanks everyone in advance for your help. I am fairly new to web development but an experienced window-based developer. Here's the structure of my Gridview Column 1 : Checkbox with SelectAll...
4
by: cmrhema | last post by:
hello I am using a gridview to display records. I have set page index for the grid. I have populated the gridview. After every 10 records I will move to the next page. All these works fine. ...
1
by: rbrowning1958 | last post by:
Hello, I wonder whether someone can explain to me how data is fetched from a database server when using ASP.NET 2.0's gridview with paging enabled? My SQL DataSource has a simple "select * from...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.