Click here to Skip to main content
15,892,575 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I,
C#
<div>
<asp:RadioButtonList ID="rdbtnlist" runat="server" TextAlign="Right" OnSelectedIndexChanged="rdb_caltotalval" AutoPostBack="true" RepeatDirection="Vertical" RepeatColumns="1">
</asp:RadioButtonList>
</div>


II,
Binding onto radiobutton list,
C#
rdwithoutlogin.DataSource = dtservices;
rdwithoutlogin.DataTextField="descript";
rdwithoutlogin.DataBind();


After binding , i got list like that.

UPS NEXT Day Air($11.00)
UPS UPS 3 Day Select($30.00)
UPS Ground($12.03)
FIRST OVERNIGHT($65.13)
STANDARD OVERNIGHT($18.03)
FEDEX 2 DAY AM($20)
FEDEX 2 DAY($30)
FEDEX EXPRESS SAVER($13.02)
GROUND HOME DELIVERY($30.00)

here is the problem, if i choose third one from list that is "UPS Ground($12.03)", but in loop first one got selected , i mean,
UPS NEXT Day Air($11.00) became true instead of UPS Ground($12.03) ----------------->item.selected.remaining list is false. i do not know how it is happening like that..
note: i did not write any code to mark first one to be selected in code behind before render the page.

And, OnSelectedIndexChanged="rdb_caltotalval" is firing at first time only, when i choose second time, OnSelectedIndexChanged="rdb_caltotalval" event is not fired.
C#
protected void rdb_caltotalval(object sender, EventArgs e)
{
foreach (ListItem item in rdwithoutlogin.Items)
{
if (item.Selected)
{
string s6 = item.Text;
}
}
}


Help needed.
Posted
Updated 23-Mar-15 21:16pm
v3
Comments
King Fisher 24-Mar-15 3:15am    
Show your OnSelectedIndexChanged event to find out
King Fisher 24-Mar-15 3:21am    
Where do you bind your Dropdown list? Is it in Page_load? if it is, set if (!IsPostBack)
{

}
Joan Magnet 24-Mar-15 4:41am    
you're not using DataValueField in your binding

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900