首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

C#菜鳥請問RadioButtonList解决办法

2012-03-01 
C#菜鳥請問RadioButtonList我想要實現讓RadioButtonList有3個選項RadioButtonList讀取資料庫內容顯示資料A

C#菜鳥請問RadioButtonList
我想要實現讓RadioButtonList有3個選項
RadioButtonList讀取資料庫內容顯示資料
A選項
B選項
C選項

點選A選項會判斷,連接到A的專屬頁面
點選B選項會判斷,連接到B的專屬頁面

請教各位大俠該怎麼寫,謝謝

[解决办法]

C# code
<asp:RadioButtonList ID="rbl" runat="server" AutoPostBack="false" RepeatLayout="Table" OnSelectedIndexChanged="rbl_SelectedIndexChanged">    <asp:ListItem Value="1">A選項</asp:ListItem>    <asp:ListItem Value="2">B選項</asp:ListItem>    <asp:ListItem Value="3">C選項</asp:ListItem></asp:RadioButtonList>public int sel;protected void rbl_SelectedIndexChanged(object sender, EventArgs e){        sel = Convert.ToInt32(rbl.SelectedItem.Value);        swith(sel)        {              case 1:                      Response.Redirect("A.aspx");                      break;              case 2:                      Response.Redirect("B.aspx");                      break;              case 3:                      Response.Redirect("C.aspx");                      break;              default:                      break;        }} 

热点排行