DataList with RadioButtons + Images: How to click on the images to activate the radiobutton?

  • Thread starter Luis Esteban Valencia Muñoz
  • Start date
L

Luis Esteban Valencia Muñoz

I have a DataList, which looks a bit like this:
<asp:DataList id="dlstCheeseType" runat="server"
RepeatColumns="4" RepeatDirection="Horizontal"
ShowHeader="False" ShowFooter="False"
ItemStyle-VerticalAlign="Top" ItemStyle-HorizontalAlign="Center"
ItemStyle-Width="25%" Width="100%">
<ItemTemplate>
<asp:RadioButton ID="cheeseChoice" Text='<%#
Container.DataItem.Row("CheeseName") %>' Runat="server"
GroupName="cheeseGroup"/>
<br>
<asp:Image id=imgCheese Runat="server"
ImageUrl='<%# "Images/" & Container.DataItem.Row("CheeseImg") %>'
Width="100px" Height="100px">
</asp:Image>
</ItemTemplate>
</asp:DataList>
(sorry for the formatting ;))

Basically it's filled with a bunch of choices from the database, with a Name
and a graphic. The user should be able to choose one of them using the radio
button (that doesn't work properly, but that's a different question ;)).

My question:
How can I add something to allow the user to click on the images and
activate the RadioButtons that way? (preferably something client-side, i.e.
without posting the full form to the server)

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top