Setting Radio Button In A Item Template Of A DataList

P

pierre.basson

Hi,

I have a DataList with an Item Template that contains an image and
three radio buttons, which are used to indicate the image's status. How
can I set the appropriate radio button to checked, when I load the
DataList from the database?

Thanks in advance.

Pierre
 
G

Guest

Hi pierre
How u know the image status
better use RadioButtonList rather than tree RadioButton
 
G

Guest

Handle the ItemDataBound event in your code. Then get the RadioButtonList
using:
RadioButtonList rbl = (RadioButtonList) e.Item.FindControl("myRBL");
This gets the RadioButtonList for the current item in the DataList. Then set
as selected the RadioButton you like.

Hope this helps!
Regards,
Kostadin Kostov
 
E

Eliyahu Goldin

Pierre,

You need to make a databind expression for button's Checked property. Read
about databinding in MSDN Library.

Eliyahu
 

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

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top