views:

9

answers:

1

Hiya,

I have a DevExpress ASPxRadioButtonList which does not have any data source for the items. When trying to assign the selected item the control doesnt have any items. I have spent hours looking at this as it is set up to similar controls which work fine.

Here is my code:

ASPX:

<dxe:ASPxRadioButtonList ID="rblPriority" runat="server" Font-Size="11px" >
    <Items>
        <dxe:ListEditItem Text="Business Critical" Value="5" />
        <dxe:ListEditItem Text="High" Value="4" />
       <dxe:ListEditItem Text="Medium" Value="3" />
        <dxe:ListEditItem Text="Low" Value="2" />
        <dxe:ListEditItem Text="Nice To Have" Value="1" />
    </Items>
</dxe:ASPxRadioButtonList>

CS:

item = rblPriority.Items.FindByValue(dt.Rows[0]["Priority"]);
if (null != item)
{
    rblPriority.SelectedIndex = item.Index;
} // if

When trying to find the Item by value it returns null for the ListEditItem. The DataTable dt has a value for priority for 3 and the item should be in there as its hard coded in the ASPX.

Can anyone shed any light on this?

Thanks

Andy

A: 

I think it was a postback which was affecting this.

anD666