Ok, I might be getting terminology confused (see: datatable), but I have a RadioButton list on my .aspx page in Visual Studio 2008. I want to select one of three options (yes, no, n/a) based on an entry in my data table (with values of Y, N, or NA). This is what I have so far:
HTML:
<asp:RadioButtonList ID="StorageRadioList" runat="server"
RepeatDirection="Horizontal">
<asp:ListItem value="Y" >Yes</asp:ListItem>
<asp:ListItem value="N" >No</asp:ListItem>
<asp:ListItem value="NA" Selected="True">N/A</asp:ListItem>
</asp:RadioButtonList>
Is there a way i can select one of the three buttons based on the value in the table. For example, if i created a hidden text box and assigned the value as a string to that textbox, could i then say like, "if txtbox==N, storageRadioList.N==selected" or something less pseudo-coded than that?
I'm trying to avoid creating a datasource//control for it, as 1) i don't understand it very well, and 2) I don't have a table that has text descriptions for each button so each one has "Yes", "no", etc. next to it. I also am unable to edit the table im working with.
Any help is appreciated.
Edit: My codebehind is C#, not Visual Basic.
I've tried
this.FuelStorageRadio.SelectedValue = equipmentDataRow["Fule_Storage_onsite"].ToString();
for the C# to select the button, but nothing works. The table is mispelled as "Fule" and only has values, "Y, N, or NA" just like my associated values listed above.
HTML:
<asp:RadioButtonList ID="StorageRadioList" runat="server"
RepeatDirection="Horizontal">
<asp:ListItem value="Y" >Yes</asp:ListItem>
<asp:ListItem value="N" >No</asp:ListItem>
<asp:ListItem value="NA" Selected="True">N/A</asp:ListItem>
</asp:RadioButtonList>
Is there a way i can select one of the three buttons based on the value in the table. For example, if i created a hidden text box and assigned the value as a string to that textbox, could i then say like, "if txtbox==N, storageRadioList.N==selected" or something less pseudo-coded than that?
I'm trying to avoid creating a datasource//control for it, as 1) i don't understand it very well, and 2) I don't have a table that has text descriptions for each button so each one has "Yes", "no", etc. next to it. I also am unable to edit the table im working with.
Any help is appreciated.
Edit: My codebehind is C#, not Visual Basic.
I've tried
this.FuelStorageRadio.SelectedValue = equipmentDataRow["Fule_Storage_onsite"].ToString();
for the C# to select the button, but nothing works. The table is mispelled as "Fule" and only has values, "Y, N, or NA" just like my associated values listed above.
Last edited: