Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - Override Skin file in CheckBoxList item

 
Thread Tools Search this Thread
Old 02-15-2008, 08:50 AM   #1
Default Override Skin file in CheckBoxList item


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


mdavis@medelect.co.uk
  Reply With Quote
Old 02-15-2008, 09:30 AM   #2
Dave Sussman
 
Posts: n/a
Default Re: Override Skin file in CheckBoxList item
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

<> wrote in message
news:79f53e11-d543-487b-8b8d-...
> 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
  Reply With Quote
Old 02-15-2008, 03:20 PM   #3
mdavis@medelect.co.uk
 
Posts: n/a
Default Re: Override Skin file in CheckBoxList item
On 15 Feb, 09:30, "Dave Sussman" <dav...@ipona.com> wrote:
> 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
>
> <mda...@medelect.co.uk> wrote in message
>
> news:79f53e11-d543-487b-8b8d-...
>
> > 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


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

Cheers,
Max


mdavis@medelect.co.uk
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to Override Collector Server Value Zebthakur MCTS 0 12-19-2008 05:52 AM
dynamic validations for checkboxlist and dropdownlist mrugesh_dulera Software 0 06-26-2007 01:56 AM
Any DVD Player that can override User Prohibitions? Walter Traprock DVD Video 3 12-03-2005 11:43 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46