Hi @Shashikant,
Thank you very much for this code.
this one is more useful for me.
but will you please clear this is correct or not
public void compareGridview()
{
//DataTable dtSelectedUsers = new DataTable();
string userName = string.Empty;
string userName2 = string.Empty;
string userId = string.Empty;
string userId2 = string.Empty;
#region comment row
foreach (GridViewRow srow in grdSearchUsers.Rows)
{
if (srow.RowType == DataControlRowType.DataRow)
{
Label lblUserName2 = (srow.Cells[0].FindControl("lblUserName") as Label);
HiddenField hdnUserId2 = (srow.Cells[0].FindControl("hdnUserId") as HiddenField);
userName2 = lblUserName2.Text.ToString();
userId2 = hdnUserId2.Value.ToString();
foreach (GridViewRow row in grdUser.Rows)
{
if (row.RowType == DataControlRowType.DataRow)
{
// this.mpe.Show();
// BindUser();
CheckBox chkRow = (row.Cells[0].FindControl("chkAction") as CheckBox);
Label lblUserName = (row.Cells[0].FindControl("lblUserName") as Label);
HiddenField hdnUserId = (row.Cells[0].FindControl("hdnUserId") as HiddenField);
userName = lblUserName.Text.ToString();
userId = hdnUserId.Value.ToString();
if (userId.Contains(userId2))
{
chkRow.Checked = true;
}
}
}
}
}
#endregion
}
becoz i have found that
foreach (GridViewRow row in grdUser.Rows)
{
**if (row.RowType == DataControlRowType.DataRow)
this line is skipped when i was debuging.
will you please find this for me.
Thank you in advance
regards by cywa