To Check the check box based on DB Value

This code snippet demonstrate to chech the check box based on getting value

if (Request.QueryString["ID"] != null)
{
lblStatus.Visible =

true;
chkStatus.Visible =

true;
radbtnUpdate.Visible =

true;
radbtnUpdate.Visible =

true;
radbtnSave.Visible =

false;
template=

new Template();
template.ID =

Convert.ToInt32(Request.QueryString["ID"]);

int id = template.ID;
template = templateProcess.GetTemplate(id);
radtxtTemplateName.Text=template.Name;
radcmbFunctionalType.SelectedValue=

Convert.ToString(template.TypeId);
radcmbNotificationMethod.SelectedValue=

Convert.ToString(template.NotificationId);
radeditTemplate.Content=template.Definition;

string a = template.StatusName.ToString();

string b = "Active";

if (a == b)
{
chkStatus.Checked =

true;
}

else
{
chkStatus.Checked =

false;
}

string A = template.IsUsing.ToString();

string B = "True";

if (A == B)
{
chkIsusing.Checked =

true;
}

else
{
chkIsusing.Checked =

false;
}

string C = template.HasAttachment.ToString();

string D = "True";

if (C == D)
{
chkAttachment.Checked =

true;
}

else
{
chkAttachment.Checked =

false;
}
}

else
{
lblStatus.Visible =

false;
chkStatus.Visible =

false;
radbtnUpdate.Visible =

false;
radbtnUpdate.Visible =

false;
}

Ebook Download
View all
Pristine
Read by 0 people
Download Now!
Learn
View all