2013-06-26 58 views
0

我已經創建了一個簡單的單選按鈕列表。我寫了簡單的功能做一些事情上選擇asp.net radiobuttonlist不會觸發選擇

這裏是單選按鈕列表

<asp:RadioButtonList ID="payment_type" CssClass="rbl_type" runat="server" TextAlign="Right" RepeatDirection="Horizontal" BorderStyle="None" OnSelectedIndexChanged="payment_type_SelectedIndexChanged"> 
     <asp:ListItem Value="0">Serbest Ödeme</asp:ListItem> 
     <asp:ListItem Value="1">Ön Tanımlı Ödeme</asp:ListItem> 
</asp:RadioButtonList> 

這裏是C#代碼

protected void payment_type_SelectedIndexChanged(object sender, EventArgs e) 
    { 
     if (payment_type.SelectedValue == "0") 
     { 
      pnl_serbest.Visible = true; 
      pnl_on_tanimli.Visible = false; 
     } 
     else 
     { 
      pnl_serbest.Visible = false; 
      pnl_on_tanimli.Visible = true; 
     } 
    } 

但它不觸發任何東西。我究竟做錯了什麼?

+0

使用AutoPostBack = true –

回答

1

添加

AutoPostBack="true" 

屬性您<asp:RadioButtonList />標籤。

+0

它不工作...它很奇怪 –

+0

有沒有在頁面上的任何JavaScript錯誤? –

+0

@ayilmaz被updatepanel包圍 –