我當前將一些值傳遞給我的一個ascx.cs文件,並根據發送的值顯示某些單選按鈕。單選按鈕被實例化在事物的的.ascx側:總是選擇頂部(有條件)單選按鈕
<asp:RadioButton ID="length5yr" GroupName="SubLength" runat="server" Visible ="false"
/>
<asp:label runat="server" id="Label5yr" Visible="false" style="width: 300px">
</asp:label>
<asp:RadioButton ID="length3yr" GroupName="SubLength" runat="server" Visible ="false"
/>
<asp:label runat="server" id="Label3yr" Visible="false" style="width: 300px">
</asp:label>
<asp:RadioButton ID="length2yr" GroupName="SubLength" runat="server" Visible ="false"
/>
<asp:label runat="server" id="Labelyr2" Visible="false" style="width: 300px">
</asp:label>
<asp:RadioButton ID="length1yr" GroupName="SubLength" runat="server" Visible ="false"
/>
<asp:label runat="server" id="Label1yr" Visible="false" style="width: 300px">
</asp:label>
<asp:RadioButton ID="lengthQuarterly" GroupName="SubLength" runat="server" Visible ="false"
/>
<asp:label runat="server" id="labelQuarterly" Visible="false" style="width: 300px">
</asp:label>
<asp:RadioButton ID="lengthMonthly" GroupName="SubLength" runat="server" Visible ="false"
/>
<asp:label runat="server" id="labelMonthly" Visible="false" style="width: 300px">
</asp:label>
欲取其單選按鈕最終被第一/頂部的一個顯示進行檢查。我已經能夠得到最後一個單選按鈕(這也給我其他問題無論如何) - 但我怎麼能得到最高的一個檢查!?
這是我如何確定顯示哪個單選按鈕的代碼 - 我只顯示了一個選項,只是爲了使代碼更易於閱讀。
foreach (Dictionary<string, string> d in orderOptions)
{
if (d["length"] == "one")
{
length1yr.Visible = true;
price1yr = d["price"];
rate1yr = d["rate"];
issues1yr = d["issues"];
premium1yr = d["premium"];
Label1yr.Text = d["description"] + "<br><br>";
Label1yr.Visible = true;
SubLength1yr = "1 year";
}
你是如何創建單選按鈕的?動態還是他們都在那裏,只是基於一些標準隱藏? – arb
AH,他們總是在那裏,只是基於標準隱藏。 –
你想要客戶端解決方案的服務器端嗎?或者它沒有關係? – arb