Hi nedash,
Please use below code.
C#
protected void OnRowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string Name = (e.Row.FindControl("Lblname") as Label).Text;
DataTable dt = (DataTable)ViewState["Estate_Info"];
foreach (DataRow row in dt.Rows)
{
for (int i = 0; i < row.ItemArray.Length; i++)
{
if (Name.ToUpper() == row.ItemArray[i].ToString().ToUpper())
{
(e.Row.FindControl("ChBpriceL") as HtmlInputCheckBox).Checked = true;
}
}
}
}
}
Vb.Net
Protected Sub OnRowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
Dim Name As String = TryCast(e.Row.FindControl("Lblname"), Label).Text
Dim dt As DataTable = DirectCast(ViewState("Estate_Info"), DataTable)
For Each row As DataRow In dt.Rows
For i As Integer = 0 To row.ItemArray.Length - 1
If Name.ToUpper() = row.ItemArray(i).ToString().ToUpper() Then
TryCast(e.Row.FindControl("ChBpriceL"), HtmlInputCheckBox).Checked = True
End If
Next
Next
End If
End Sub