Prem
Prem

Reputation: 5987

Bulk insert with gridview using C# asp.net

I'm using checkbox to select the rows in the gridview. How do I insert the muliple selected rows into the table opening the connection for only one time.

Upvotes: 0

Views: 2205

Answers (2)

cjk
cjk

Reputation: 46425

When you postback, read all the checked rows and put the data into a DataTable. You can then use a SqlBulkCopy object to push that DataTable into your database table.

Upvotes: 3

osmirnov
osmirnov

Reputation: 1

Using JS to write into hidden field when user (un)checks a checkbox or to perform ajax call to server with id checked row.

Upvotes: 0

Related Questions