For Programmers: Free Programming Magazines  


Home > Archive > ASP .NET > June 2007 > Customize Option Group List









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Customize Option Group List
Giles Papworth

2007-06-28, 4:18 am

have an asp.net option group list.
I need to be able to style it or at least override the render event so i can
put in my own styles. Short of developing an inherited control of the option
group im not sure what else i can do.
I suppose the best way of explaining what i want to try and do is like this:

The option group list is rendered (when in flow layout) is rendered like this:
<span id="rbStatus">
<label for="rbStatus_0">Employed</label>
<input id="rbStatus_0" type="radio" name="rbStatus" value="1"
tabindex="1000" />
<br>
<label>

and so on and so forth. I need to change it so that it renders as:

<div id="rbStatus">
<div for="rbStatus_0">Employed</label>
<input id="rbStatus_0" type="radio" name="rbStatus" value="1"
tabindex="1000" />
<br>
<label>

or something to that effect. Does anyone have any idea how i can go about
this?
bruce barker

2007-06-28, 7:11 pm

not sure what you are trying to do. it looks like you want to change the
span to a div. the only difference is the span is inline by default and
the div is block. you could change the span to a block element with css
(set the controls class), not need to make any changes to the control.

it looked like you might have wanted to change the label to a div. this
is bad idea. all input controls should have a <label> (not to be
with the asp:label, which is just a span). for check/radio
inputs, the label text is clickable. also when the using a page reader
(say for the blind) is used, it knows the label goes with the control.
see the Web Accessibility guidelines.


-- bruce (sqlwork.com)


Giles Papworth wrote:
> have an asp.net option group list.
> I need to be able to style it or at least override the render event so i can
> put in my own styles. Short of developing an inherited control of the option
> group im not sure what else i can do.
> I suppose the best way of explaining what i want to try and do is like this:
>
> The option group list is rendered (when in flow layout) is rendered like this:
> <span id="rbStatus">
> <label for="rbStatus_0">Employed</label>
> <input id="rbStatus_0" type="radio" name="rbStatus" value="1"
> tabindex="1000" />
> <br>
> <label>
>
> and so on and so forth. I need to change it so that it renders as:
>
> <div id="rbStatus">
> <div for="rbStatus_0">Employed</label>
> <input id="rbStatus_0" type="radio" name="rbStatus" value="1"
> tabindex="1000" />
> <br>
> <label>
>
> or something to that effect. Does anyone have any idea how i can go about
> this?

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com