Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: Add an optgroup element to a ListBox control


Message #1 by Imar@S... on Wed, 16 Oct 2002 14:50:29
Yikes. This forces me to write my own custom databinding as well.

I think I am going to abuse the Repeater control for this. Should be easy
to add some custom stuff, as well as repeated data.
Thanks for your thoughts on this.

Cheers,

Imar



> indeed, I think the best thing to do is to create a custom control
> which outputs the raw HTML to the page building your listbox as you
> need it. for example:
>
> using System.Web;
> using System.Web.UI;
>
> public class MyListControl : Control
> {
> 	protected override void Render(HtmlTextWriter Output)
> 	{
> 		Output.Write("<select name=\"test\" multiple>");
> 		Output.Write("<optgroup label=\"Level 1\">");
> 		//etc
> 	}
> }
>
> Phil
>
>



  Return to Index