내 html.asp 포스트 백 문제 및 html 컨트롤
<input id="rdb1" type="radio" name="rdbData" checked="checked" />
<input id="rdb2" type="radio" name="rdbData" />
<asp:Button ID="btnTest" runat="server" Text="Test" OnClick="btnTest_Click" />
버튼 만 asp:button
하지만 페이지는 내가 체크 rdb2
와 버튼 btnTest
을 클릭하면 부하 RDB1이 selected.But입니다 not.First 시간이 radio buttons
있으며, 페이지가 새로 고쳐지고이 나는 것을 방지 button.To 1 redio을 선택 이 같은 시도 jquery
. Document.ready
내부 :
var btnTest = "<%=btnTest.ClientID %>";
$('#' + btnTest).bind("click", function() {
if ($('#rdb1').attr("checked")) {
$('#rdb2').attr("checked", false);
$('#rdb1').attr("checked", true);
}
else {
$('#rdb1').attr("checked", false);
$('#rdb2').attr("checked", true);
}
});
그러나이 아니 우리가 situation.Where 이러한 유형의 내가 wrong.Any 아이디어 또는 alternative.Thanks를 얻고 처리 할 수 work.How.
'bind()'이벤트에서'e.preventDefault'를 시도하십시오. – elclanrs