Monday, March 26, 2012

setting selecteditem item on databound radiobuttonlist in a repeater

I'm trying to figure out how to set the selected item of databound
radiolistbutton once they are in a repeater (i.e. I want one item
pre-selected instead of nothing selected). In the html there is a property
for selecteditem but it generates an error saying it can only be set at
runtime. Haven't been able to figure out or find how to do that.

Any help or direction would be appreciated.
Rodradiobuttonlist.selecteditem is a "read only" property--you can't set it. Set
either selectedvalue or selectedindex, which you can do either by databinding
in the html or at ItemDataBound in the code-behind.

Bill

"Rod Snyder" wrote:

> I'm trying to figure out how to set the selected item of databound
> radiolistbutton once they are in a repeater (i.e. I want one item
> pre-selected instead of nothing selected). In the html there is a property
> for selecteditem but it generates an error saying it can only be set at
> runtime. Haven't been able to figure out or find how to do that.
> Any help or direction would be appreciated.
> Rod
>

0 comments:

Post a Comment