2013-05-29 37 views
0

在這裏你可以看到我的html代碼。我需要運行OnSelectedIndexChanged事件,但我必須阻止回發所有頁面。我該怎麼辦?更新面板打破RadioButtonList的OnSelectedIndexChanged事件

<asp:UpdatePanel runat="server" ID="upRemittance"> 
      <ContentTemplate> 

        <asp:RadioButtonList runat="server" ID="rblRemittance" AutoPostBack="True" OnSelectedIndexChanged="rblRemittance_OnSelectedIndexChanged"> 
        </asp:RadioButtonList> 

      </ContentTemplate> 
     </asp:UpdatePanel> 

RadioButtonList的裝訂方法:

List<remittance> remittances = _mainService.RemitanceActiveList().ToList(); 
      if (remittances.Count > 0) 
      { 
       rblRemittance.DataSource = remittances; 
       rblRemittance.DataTextField = "BankName"; 
       rblRemittance.DataValueField = "RemitanceId"; 
       rblRemittance.DataBind(); 
      } 
+0

什麼問題? –

+0

刪除UpdatePanel – Roar

+0

@YuriyRozhovetskiy OnSelectedIndexChanged事件不會被調用。 – cagin

回答

0

我用Ajax調用解決它。

<script type="text/javascript"> 
    $(document).ready(function() { 
     $("input[type = radio]").each(function (index, value) { 
      $(value).click(function() { 

       $.ajax({ 
        type: "POST", 
        url: "http://localhost:2782/TestPage.aspx/GetBank", 
        data: "{id:" + value.defaultValue + "}", 
        contentType: "application/json; charset=utf-8", 
        dataType: "json", 
        success: function (data) { 
         $("#dvBankInfo").empty(); 
         $("#dvBankInfo").append(data.d); 
        } 
       }); 
      }); 
     }); 
    }); 
</script>