how to retrive the datagrid rows when the check box is selected?

Posted by Savari_Arm under WPF on 7/10/2012 | Points: 10 | Views : 19823 | Status : [Member] | Replies : 4
in the windows forms i m having datagrid view with check box . when i m selecting mulitple check boxs and give submit button it(selected rows) will show in the other forms? how is it any one help me....




Responses

Posted by: Muralidosscm on: 7/10/2012 [Member] Starter | Points: 25

Up
0
Down
http://forums.asp.net/t/1125079.aspx

Regards
Muralidoss M

Savari_Arm, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Savari_Arm on: 7/10/2012 [Member] Starter | Points: 25

Up
0
Down
i am asking in windows form datagridview .

Savari_Arm, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ranjeet_8 on: 7/11/2012 [Member] [MVP] Gold | Points: 25
Posted by: Rickeybglr on: 7/11/2012 [Member] Starter | Points: 25

Up
0
Down
Ranjeet,
u can get idea from below code..

foreach (GridViewRow row in gvAdmin.Rows) //traversing the each row of gridview
{
CheckBox checkbox = (CheckBox)row.FindControl("chkRows");
if (checkbox.Checked == true) //Checking the checkbox is checked or not!!
{
int iUserId = Convert.ToInt32(gvAdmin.DataKeys[row.RowIndex].Value); // Retreive the Employee ID
// Pass the value of the selected Employye ID to the update ommand for soft delete.
sqlDSshowUser.UpdateParameters["pk_user_id"].DefaultValue = iUserId.ToString();
i = sqlDSshowUser.Update(); //i is used to store no. of rows affected
}
}
if (i > 0)
{
///record found
}

else //run when no record is mark checked for delete
{
//select the record .. }
}

Savari_Arm, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response