if (e.Row.RowType == DataControlRowType.DataRow)
{
CheckBox chkStatus = (CheckBox)e.Row.FindControl("chkIsActive");
CheckBox chkRigid = (CheckBox)e.Row.FindControl("chkIsRigid");
HiddenField hdntitle = (HiddenField)e.Row.FindControl("hdntitle");
Label lblStatus = (Label)e.Row.FindControl("lblStatus");
Label lblRigStatus = (Label)e.Row.FindControl("lblRigStatus");
DropDownList ddlUnitHead = (DropDownList)e.Row.FindControl("ddlUnitHead");
DropDownList ddlGroup = (DropDownList)e.Row.FindControl("ddlGroup");
DropDownList ddlDivision = (DropDownList)e.Row.FindControl("ddlDivision");
Bindddl_GroupHead(ddlUnitHead);
Bindddl_Group(ddlGroup);
Bindddl_Division(ddlDivision);
if (ViewState["ViewUpdateEdit"] != null)
{
RowUpdate = new DataTable();
RowUpdate = (DataTable)ViewState["ViewUpdateEdit"];
}
else
{
BindGridView();
RowUpdate = new DataTable();
RowUpdate = (DataTable)ViewState["ViewUpdateEdit"];
}
if (RowUpdate != null && RowUpdate.Rows.Count > 0)
{
DataRow[] SelectedValues = RowUpdate.Select("ID=" + hdntitle.Value + "");
if (ddlUnitHead != null)
{
ddlUnitHead.Items.FindByValue(Convert.ToString(SelectedValues[0]["UnitHeadID"])).Selected = true;
}
if (ddlDivision != null)
{
ddlDivision.Items.FindByValue(Convert.ToString(SelectedValues[0]["DivisionID"])).Selected = true;
}
if (ddlGroup != null)
{
ddlGroup.Items.FindByValue(Convert.ToString(SelectedValues[0]["GroupID"])).Selected = true;
}
string Status = Convert.ToString(SelectedValues[0]["IsActive"]);
string Rigid = Convert.ToString(SelectedValues[0]["Rigid"]);
if (!string.IsNullOrEmpty(Status))
{
if (chkStatus != null)
{
if (Status.ToLower() == "true")
{
chkStatus.Checked = true;
}
else
{
chkStatus.Checked = false;
}
}
else
{
if (Status.ToLower() == "true")
{
lblStatus.Text = "Active";
}
else
{
lblStatus.Text = "In Active";
}
}
}
if (!string.IsNullOrEmpty(Rigid))
{
if (chkRigid != null)
{
if (Rigid.ToLower() == "true")
{
chkRigid.Checked = true;
}
else
{
chkRigid.Checked = false;
}
}
else
{
if (Rigid.ToLower() == "true")
{
lblRigStatus.Text = "Active";
}
else
{
lblRigStatus.Text = "In Active";
}
}
}
}
}