On Check Grid view Rows color change
..................................................................................................
protected void chkStatus_CheckedChanged(object sender, EventArgs e)
{
private const string colorPresent = "#BDF8B9";
private const string colorAbsent = "#FFB5B2";
//to enable/disable Isgranted checkbox.
CheckBox chk = (CheckBox)sender;
CheckBox chkGr = (CheckBox)((CheckBox)sender).Parent.Parent.FindControl("chkGranted");
if (chk.Checked)
{
chkGr.Checked = false;
chkGr.Enabled = false;
chkGr.Text = "---";
}
else
{
chkGr.Enabled = true;
chkGr.Text = "IsGranted";
}
CheckBox checkBox = (CheckBox)sender;
GridViewRow parent = (GridViewRow)checkBox.Parent.Parent;
TextBox empty = (TextBox)parent.FindControl("txtRemarks");
empty.Text = string.Empty;
if (checkBox.Checked)
{
empty.Enabled = false;
parent.BackColor = ColorTranslator.FromHtml("#BDF8B9");
return;
}
empty.Enabled = true;
parent.BackColor = ColorTranslator.FromHtml("#FFB5B2");
}
..................................................................................................
protected void chkStatus_CheckedChanged(object sender, EventArgs e)
{
private const string colorPresent = "#BDF8B9";
private const string colorAbsent = "#FFB5B2";
//to enable/disable Isgranted checkbox.
CheckBox chk = (CheckBox)sender;
CheckBox chkGr = (CheckBox)((CheckBox)sender).Parent.Parent.FindControl("chkGranted");
if (chk.Checked)
{
chkGr.Checked = false;
chkGr.Enabled = false;
chkGr.Text = "---";
}
else
{
chkGr.Enabled = true;
chkGr.Text = "IsGranted";
}
CheckBox checkBox = (CheckBox)sender;
GridViewRow parent = (GridViewRow)checkBox.Parent.Parent;
TextBox empty = (TextBox)parent.FindControl("txtRemarks");
empty.Text = string.Empty;
if (checkBox.Checked)
{
empty.Enabled = false;
parent.BackColor = ColorTranslator.FromHtml("#BDF8B9");
return;
}
empty.Enabled = true;
parent.BackColor = ColorTranslator.FromHtml("#FFB5B2");
}
No comments:
Post a Comment