Click here to Skip to main content
15,888,401 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi
I'm beginner.

I've a gridview namely "gridview1"
DataKeyName of gridview1 is "ID"
gridview1 have datasource namely "AccessDataSource1"
There is "checkbox1" control inside a templatefield.
I want to select multiple rows using checkbox1 and use the values of "ID" to insert multiple records to another AccessDataSource2 DataSource.
Please guide me.
Posted
Updated 14-Oct-15 14:46pm
v2
Comments
_Amy 15-Oct-15 2:40am    
What have you tried so far? What error you are getting? Have you googled it?

As per my understand the post your requirement is, based on checkbox selection you need to perform some action like button click at that time based on DataKeyNames of gridview you need to perform some action.

Ex:
C#
Protected void btnSave_Click(object sender, EventArgs e)
{
     Button btn=sender as Button;
     GridViewRow row = btn.NamingContainer as GridViewRow;
     //get datakeynames of gridview
     int KeyValue=Convert.ToInt32(gv.DataKeys[row.RowIndex].Value.ToString());
     ///do your action based on KeyValue
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900