Link to home
Start Free TrialLog in
Avatar of maqskywalker
maqskywalker

asked on

Update multiple rows at once in ASP.Net GridView

Hi experts,

I saw this working ASP.net example:

https://www.c-sharpcorner.com/UploadFile/1e050f/edit-and-update-record-in-gridview-in-Asp-Net/

In that example when when you click on edit link of a row in the GridView, then all the items in the row become editable and then if you edit an item in the row you can then press the update button and it will update the record.

How can I revise that example to the following?:

on page load , show every row in the Name column in edit mode.
Then, above the GridView grid put a button that says Update.
So if I edit any of the names in any of the rows and then click that update button it will update the names I edited.

To summarize,
instead of having to click on each row one at a time and then update a name like the above example currently does, I just want to have the GridView launch with all the records in the Name column in edit mode, so I can simply make a Name change and then just click an update button one time to update the multiple names I edited.
Avatar of sammySeltzer
sammySeltzer
Flag of United States of America image

I thought this sub -> ShowData(); will do exactly what you are asking and since  you just want only name, then your SELECT statement should be:

        adapt = new SqlDataAdapter("Select ID,Name from tbl_Employee",con);  

Open in new window


If you don't want ID column to show, then hide it with simple css on the ID control: style="display:none;"
ASKER CERTIFIED SOLUTION
Avatar of Mrunal
Mrunal
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial