HighTechTalks DotNet Forums  

DropDownList <optgroup>

ASP.net Web Controls microsoft.public.dotnet.framework.aspnet.webcontrols


Discuss DropDownList <optgroup> in the ASP.net Web Controls forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
 
Posts: n/a

Default DropDownList <optgroup> - 07-10-2005 , 12:39 AM






Just wondering if anyone has figured out a way to add <optgroup> to
DropDownLists?
Theoretical code that should work:

<aspropDownList id="ddlWeightClass" runat="server">
<optgroup label="Light Weight">
<asp:ListItem Value="50">50</asp:ListItem>
<asp:ListItem Value="51">51</asp:ListItem>
<asp:ListItem Value="52">52</asp:ListItem>
<asp:ListItem Value="53">53</asp:ListItem>
</optgroup>
<optgroup label="Middle Weight">
<asp:ListItem Value="120">120</asp:ListItem>
<asp:ListItem Value="121">121</asp:ListItem>
<asp:ListItem Value="122">122</asp:ListItem>
</optgroup>
</aspropDownList>

Which I wish would render as:

<select name="ddlWeightClass" id="ddlWeightClass">
<optgroup label="Light Weight">
<option value="50">50</option>
<option value="51">51</option>
<option value="52">52</option>
</optgroup>
<optgroup label="Middle Weight">
<option value="120">120</option>
<option value="121">121</option>
<option value="122">122</option>
</optgroup>
</select>

here is a link to a similar example
http://www.webdevtips.com/webdevtips...orm_tags.shtml

Thank you,
Art Clark



Reply With Quote
  #2  
Old   
AT
 
Posts: n/a

Default Re: DropDownList <optgroup> - 07-11-2005 , 01:36 PM






You're probably going to have to create your own control. You'll have
to have a collection of optgroups, with each one having a collection of
listitems.

It's like a table, which has a collection of rows, each of which has a
collection of cells.

I'm looking into writing a table control that will allow me to have
tbody, thead and tfoot tags, and it's the same sort of pain in the
rear.

Sorry,
Lisa


user (AT) sympatico (DOT) ca wrote:
Quote:
Just wondering if anyone has figured out a way to add <optgroup> to
DropDownLists?
Theoretical code that should work:

aspropDownList id="ddlWeightClass" runat="server"
optgroup label="Light Weight"
asp:ListItem Value="50">50</asp:ListItem
asp:ListItem Value="51">51</asp:ListItem
asp:ListItem Value="52">52</asp:ListItem
asp:ListItem Value="53">53</asp:ListItem
/optgroup
optgroup label="Middle Weight"
asp:ListItem Value="120">120</asp:ListItem
asp:ListItem Value="121">121</asp:ListItem
asp:ListItem Value="122">122</asp:ListItem
/optgroup
/aspropDownList

Which I wish would render as:

select name="ddlWeightClass" id="ddlWeightClass"
optgroup label="Light Weight"
option value="50">50</option
option value="51">51</option
option value="52">52</option
/optgroup
optgroup label="Middle Weight"
option value="120">120</option
option value="121">121</option
option value="122">122</option
/optgroup
/select

here is a link to a similar example
http://www.webdevtips.com/webdevtips...orm_tags.shtml

Thank you,
Art Clark


Reply With Quote
  #3  
Old   
raul
 
Posts: n/a

Default RE: DropDownList optgroup - 08-30-2007 , 02:12 PM



An easy implementation of an Asp Net DropDownList with optgroup support can be found at http://www.codeplex.com/SharpPieces

Enjoy!

From http://www.developmentnow.com/g/15_2...t-optgroup.htm

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.