J
Jerome
Hello,
I populate dynamically a CheckBoxList then try to apply a specific
font/size/color to the items of that CheckBoxList.
My code compiles but it seems I cannot reach the items...
(following pieces of code in C#)
********************************************************
//I populate my CheckBoxList called cblSpec
cblSpec.DataSource = specColl;
cblSpec.DataValueField = "Id";
cblSpec.DataTextField = "Libelle";
cblSpec.DataBind();
//then I try to apply a specific font, color, whatever style
//to each item in that CheckBoxList
foreach (ListItem item in cblSpec.Items)
{
item.Attributes.CssStyle.Add("font","10pt verdana");
item.Attributes.CssStyle.Add("color","red");
}
**************************************************
I cannot find any verdana keyword in the html source of the page once
I've launched it. The style (font/color) simply disappears into thin
air and is never rendered.
All I was able to do is apply a style to the CheckBoxList itself but
only the color would be applied downward to the items, not the font
****************************************************
System.Web.UI.AttributeCollection myAttrib = cblSpec.Attributes;
myAttrib.CssStyle.Add("color","blue"); //works on the items
myAttrib.CssStyle.Add("font-weight","bold"); //works on the items
myAttrib.CssStyle.Add("font","10pt times"); //does NOT reach the items
****************************************************
I cant find any exemple anywhere on the web or MS help.
Seems like it's impossible but I might be wrong so if anyone ever
managed to do such a thing, please copy/paste some code.
thx,
Jerome - (e-mail address removed)
I populate dynamically a CheckBoxList then try to apply a specific
font/size/color to the items of that CheckBoxList.
My code compiles but it seems I cannot reach the items...
(following pieces of code in C#)
********************************************************
//I populate my CheckBoxList called cblSpec
cblSpec.DataSource = specColl;
cblSpec.DataValueField = "Id";
cblSpec.DataTextField = "Libelle";
cblSpec.DataBind();
//then I try to apply a specific font, color, whatever style
//to each item in that CheckBoxList
foreach (ListItem item in cblSpec.Items)
{
item.Attributes.CssStyle.Add("font","10pt verdana");
item.Attributes.CssStyle.Add("color","red");
}
**************************************************
I cannot find any verdana keyword in the html source of the page once
I've launched it. The style (font/color) simply disappears into thin
air and is never rendered.
All I was able to do is apply a style to the CheckBoxList itself but
only the color would be applied downward to the items, not the font
****************************************************
System.Web.UI.AttributeCollection myAttrib = cblSpec.Attributes;
myAttrib.CssStyle.Add("color","blue"); //works on the items
myAttrib.CssStyle.Add("font-weight","bold"); //works on the items
myAttrib.CssStyle.Add("font","10pt times"); //does NOT reach the items
****************************************************
I cant find any exemple anywhere on the web or MS help.
Seems like it's impossible but I might be wrong so if anyone ever
managed to do such a thing, please copy/paste some code.
thx,
Jerome - (e-mail address removed)