asp:radiobuttonlist table columns

I just found something handy – when using an ASP.NET RadioButtonList with default layout (html tables are used for laying out the options) you can inject </td><td> into  a listitem’s Text property as a hack to get it to layout the data in multiple columns. this is useful if you have say, a list of products with prices like so:

<asp:RadioButtonList ID=”list1″ runat=”server”>

<asp:ListItem Value=”0″ Text=”First Product </td><td>$5.00″</asp:ListItem>

<asp:ListItem Value=”1″ Text=”Second Product </td><td>$10.00″</asp:ListItem>

<asp:ListItem Value=”2″ Text=”Third Product </td><td>$15.00″</asp:ListItem>

</asp:RadioButtonList>

 

injecting the </td><td> into each item will make the prices line up nicely in their own column. handy.

Advertisements
This entry was posted in ASP.NET and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s