Hello Guys,
I am using a checkboxlist which I am populating from the database using Databind(). And i am having Dropdownlist in UpdatePanel to avoid postbacks which is also populated form database. Each Item in dropdownlist-> Associated to Many Items in Checkboxlist. Is there any way I can Make Associated listitems bold(to highlight them) on Dropdown Selected Index Changed Event so that user will know he has to select the highlighted checkboxes for the selected value in dropdownlist? I have tried using the listitem Attributes as well but it's not working. See the code below.
protected void LOSDropDownList_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
string selectedValue = LOSDropDownList.SelectedValue;
LOSQuestionsBOReadOnlyList QuestionList = LOSQuestionsBOReadOnlyList.GetLOSQuestionsBOReadOnlyListByLevelOfServiceId(Convert.ToInt32(selectedValue));
if (!selectedValue.Equals(""))
{
foreach (ListItem Item in QuestionCheckboxList.Items)
{
Item.Attributes.CssStyle.Clear();
if(QuestionList.FirstOrDefault(Val => (Val.ServiceLevelQuestion_ID == int.Parse(Item.Value.ToString()))) == null)
{
Item.Attributes.CssStyle.Add("font-weight", "bold");
}
else Item.Attributes.CssStyle.Add("font-weight", "normal");
}
}
}
catch (Exception ex)
{
ExceptionPolicy.HandleException(ex, "Event_File_Policy");
}
}
Your help will be appreciated
Thanks And Regards,
Chetan