Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / February 2008

Tip: Looking for answers? Try searching our database.

Override Skin file in CheckBoxList item

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mdavis@medelect.co.uk - 15 Feb 2008 08:50 GMT
Hello,
I have a need to set the formatting of the checkboxes dynamically
added to a checkboxlist on my website. The problem is that we use a
master.skin file that overrides any classes I add to the listitems as
they are added to the checkboxlist.
I have experimented with SkinIDs in the past, but am unable to add a
SkinID to the items in the checkboxlist.

I add the items like this:
ListItem itemCategory = new ListItem();
itemCategory.Text = categoryList[i]["CategoryName"].ToString();
itemCategory.Value = categoryList[i]["CategoryID"].ToString();
cblCategories.Items.Add(itemCategory);

I've tried adding a class like this:
itemCategory.Attributes.Add("class", string.Concat("checkBoxOrder",
orderLevel.ToString()));

but that gets overriden by the skin file:
<asp:CheckBox runat="server" CssClass="checkBox"></asp:CheckBox>

Any help getting SkinID set on the checkboxlist items, or an
alternative way of styling would be much appreciated.

Thanks,
Max
Dave Sussman - 15 Feb 2008 09:30 GMT
Are you using the Theme or StylesheetTheme attribute? With Theme, the
properies of the skin will override properties declared directly on a
control, whereas StylesheetTheme will only appliy skin properties if they
aren't already set on the control. So Stylesheettheme won't overwrite.

d

> Hello,
> I have a need to set the formatting of the checkboxes dynamically
[quoted text clipped - 22 lines]
> Thanks,
> Max
mdavis@medelect.co.uk - 15 Feb 2008 15:20 GMT
> Are you using the Theme or StylesheetTheme attribute? With Theme, the
> properies of the skin will override properties declared directly on a
[quoted text clipped - 33 lines]
> > Thanks,
> > Max

I didn't realise about the StyleSheetTheme attribute - what a great
find! Looks like it's the answer.

Cheers,
Max

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.