Setting Radio Button In A Item Template Of A DataList

  • Thread starter Thread starter pierre.basson
  • Start date Start date
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
 
Hi pierre
How u know the image status
better use RadioButtonList rather than tree RadioButton
 
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
 
Pierre,

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

Eliyahu
 
Back
Top