[RESOLVED] [2008] selecting default item for RadioButtonList in asp.net 2.0
hello...
i have a RadioButtonList in my web application which is developing by asp.net 2.0, i just need some help,
Code:
<asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="true" >
<asp:ListItem>Month View</asp:ListItem>
<asp:ListItem>Week View</asp:ListItem>
<asp:ListItem>Day View</asp:ListItem>
</asp:RadioButtonList>
when the page loads by default the second item is selected, how can i change this default item?
thanks
Re: [2008] selecting default item for RadioButtonList in asp.net 2.0
RadioButtonList1.SelectedIndex = 0
Re: [2008] selecting default item for RadioButtonList in asp.net 2.0
where should i put it?
i put it in page_load event, but doesn't work that way, its autopost back and everytime when i select something on everypage load the first item is selected, only on the first time that the page loads the fist item should be selected then the user can select anyone of them
Re: [2008] selecting default item for RadioButtonList in asp.net 2.0
Place it in a Page.IsPostBack check so that the default item is selected only if the page is being loaded for the first time, but not during postbacks.
Re: [2008] selecting default item for RadioButtonList in asp.net 2.0
thanks alot... problem sloved
Re: [RESOLVED] [2008] selecting default item for RadioButtonList in asp.net 2.0
No problem, feel free to post back any time you have more questions.