gpt4 book ai didi

asp.net - RadioButtonList 回发后未选中

转载 作者:行者123 更新时间:2023-12-02 14:16:11 26 4
gpt4 key购买 nike

当我单击 ASP.NET 页面上的按钮控件时,我的单选按钮列表在回发后未选中地返回。

<asp:RadioButtonList ID="rblSgkOzel" runat="server" EnableViewState="true">
<asp:ListItem Text="SGK Kapsamında" Value="sgk" Selected="True"/>
<asp:ListItem Text="Özel" Value="ozel" />
<asp:ListItem Text="Hasta Adına" Value="hasta" />
</asp:RadioButtonList>
<小时/>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="denemeRepeater.aspx.cs"
Inherits="KlinikMuhasebe.denemeRepeater" %>

<%@ Import Namespace="MedulaRADClassLib" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="JS/reset-fonts-grids.css" rel="stylesheet" type="text/css" />
<link href="css.css" rel="stylesheet" type="text/css" />
<link href="_cssV3.css" rel="stylesheet" type="text/css" />

<script src="JS/jquery-1.3.2.min.js" type="text/javascript"></script>

<script src="JS/liquid-canvas.js" type="text/javascript"></script>

<script src="JS/liquid-canvas-plugins.js" type="text/javascript"></script>

<script type="text/javascript" src="js_Eski/JScript.js" language="javascript"></script>

<script type="text/javascript" src="js_Eski/overlib.js" language="javascript"></script>

<script src="JS/boxy/jquery.boxy.js" type="text/javascript"></script>

<style>
.imgOpenClose
{
}
body
{
color: Black;
}
</style>

<script type="text/javascript">
$(document).ready(function() {

$('.imgOpenCloseKurum').click(function() {
if ($(this).attr("src") == "images/openTree.gif") {
$(this).attr("src", "images/closeTree.gif");
$($(this).parent().get(0)).find('div').eq(0).show();
}
else {
$(this).attr("src", "images/openTree.gif");
$($(this).parent().get(0)).find('div').eq(0).hide();
}
});

$('.imgOpenClose').click(function() {
if ($(this).attr("src") == "images/openTree.gif") {
$(this).attr("src", "images/closeTree.gif");
$(this).parent().find('div').eq(0).show();
}
else {
$(this).attr("src", "images/openTree.gif");
$(this).parent().find('div').eq(0).hide();
}
});


$("input:radio").click(function() {
$("input:radio").each(function() {
$(this).attr("checked", "")
});
$(this).attr("checked", "checked");
}).attr("checked", "");

$("input:checkbox").click(function() {
if ($(this).attr('checked')) {
$(this).next().html("Ücretli Seans");
//$(this).attr('checked', '');
}
else {
$(this).next().html("Bedelsiz Seans");
//$(this).attr('checked', 'checked');
}

})
});
</script>

</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div style="text-align: left;">
<div class="divKriter">
<table>
<thead>
<tr>
<th colspan="2">
FATURA BASKI KRİTERLERİ
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<asp:RadioButtonList ID="rblSgkOzel" runat="server" EnableViewState="true">
<asp:ListItem Text="SGK Kapsamında" Value="sgk" Selected="True"/>
<asp:ListItem Text="Özel" Value="ozel" />
<asp:ListItem Text="Hasta Adına" Value="hasta" />
</asp:RadioButtonList>
</td>
<td>
<asp:TextBox ID="txtTarihi" runat="server" ToolTip="Son Tarihi" />
<cc1:CalendarExtender ID="txtTarihi_CalendarExtender" runat="server" Enabled="True"
TargetControlID="txtTarihi" Format="dd.MM.yyyy">
</cc1:CalendarExtender>
&nbsp;<br />
<asp:CheckBox ID="cbBedelsiz" runat="server" Text="Ücretli Seans" Checked="true" />
<br />
<asp:Button ID="btnFaturaNolariGetir" runat="server" Text="Faturaları Getir" OnClick="btnFaturaNolariGetir_Click" />
&nbsp;
</td>
</tr>
<tr>
<td>
&nbsp;
</td>
<td>
<asp:DropDownList ID="ddlFaturaNolar" runat="server" />
<asp:Button ID="btnFaturaDetaylariniGetir" runat="server" Text="Fatura Detayları"
OnClick="btnFaturaDetaylariniGetir_OnClick" />
</td>
</tr>
</tbody>
</table>
</div>
<br />
<br />
<br />
<br />
<asp:Repeater ID="rptSGK" runat="server" OnItemDataBound="rpt_OnItemDataBound">
<ItemTemplate>
<div class="divKurumItem">
<img class="imgOpenCloseKurum" src="images/openTree.gif" />
<asp:RadioButton ID="rbKurum" runat="server" GroupName="rbKurumlar" />
<%# DataBinder.Eval(Container.DataItem, "kurumAdi")%>
<div style="display: none; margin-left: 10px;">
<asp:Repeater ID="rptHastalar" runat="server" OnItemDataBound="rptHastalar_OnItemDataBound">
<ItemTemplate>
<div style="display: block; margin-left: 10px;">
<img class="imgOpenClose" src="images/openTree.gif" />
<%# DataBinder.Eval(Container.DataItem, "adiSoyadi")%><br />
<div id='hid_<%# DataBinder.Eval(Container.DataItem, "refHasta_id")%>' style="margin: 10px;
display: none;">
<asp:HiddenField runat="server" ID="hdn1" Value='<%# total = 0 %>' />
<asp:Repeater ID="rptSeanslar" runat="server">
<HeaderTemplate>
<table border="1" cellpadding="5" cellspacing="2" style="margin-left: 30px;">
<thead>
<tr>
<th>
Seans Tarihi
</th>
<th>
Başvuru No.
</th>
<th>
Fatura Teslim No.
</th>
<th>
Fatura No.
</th>
</tr>
</thead>
<tbody>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<%# DataBinder.Eval(Container.DataItem, "tarihi", "{0:d}") %>
</td>
<td>
<%# (rblSgkOzel.SelectedIndex==0) ? DataBinder.Eval(Container.DataItem, "basvuruNo") : "" %>
</td>
<td>
<%# (rblSgkOzel.SelectedIndex==0) ? DataBinder.Eval(Container.DataItem, "faturaTeslimNo") : "" %>
</td>
<td>
<%# (rblSgkOzel.SelectedIndex==0) ? DataBinder.Eval(Container.DataItem, "faturaNo") : ""%>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</tbody> </table> </div>
</FooterTemplate>
</asp:Repeater>
</div>
<asp:HiddenField runat="server" ID="hdn" Value='<%# total = total + 1 %>' />
</ItemTemplate>
<FooterTemplate>
<div style="width: 500px; text-align: right; display: block;">
Toplam Satır Sayısı:
<%# total %>
</div>
</FooterTemplate>
</asp:Repeater>
</div>
<br />
</div>
</ItemTemplate>
</asp:Repeater>
<br />
<br />
<asp:Repeater ID="rptOzel" runat="server" OnItemDataBound="rpt_OnItemDataBound">
<ItemTemplate>
<div class="divKurumItem">
<img class="imgOpenCloseKurum" src="images/openTree.gif" />
<asp:RadioButton ID="rbKurumOzel" runat="server" GroupName="rbKurumlar" />
<%# DataBinder.Eval(Container.DataItem, "kurumAdi")%>
<div style="display: none; margin-left: 10px;">
<asp:Repeater ID="rptHastalar" runat="server" OnItemDataBound="rptHastalar_OnItemDataBound">
<ItemTemplate>
<div style="display: block; margin-left: 10px;">
<img class="imgOpenClose" src="images/openTree.gif" />
<%# DataBinder.Eval(Container.DataItem, "adiSoyadi")%><br />
<div id='hid_<%# DataBinder.Eval(Container.DataItem, "refHasta_id")%>' style="margin: 10px;
display: none;">
<asp:HiddenField runat="server" ID="hdn1" Value='<%# total = 0 %>' />
<asp:Repeater ID="rptSeanslarOzel" runat="server">
<HeaderTemplate>
<table border="1" cellpadding="5" cellspacing="2" style="margin-left: 30px;">
<thead>
<tr>
<th>
Seans Tarihi
</th>
</tr>
</thead>
<tbody>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<asp:CheckBox ID="cbSeansOzel" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "tarihi", "{0:d}") %>' />
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</tbody> </table> </div>
</FooterTemplate>
</asp:Repeater>
</div>
<asp:HiddenField runat="server" ID="hdn" Value='<%# total = total + 1 %>' />
</ItemTemplate>
<FooterTemplate>
<div style="width: 500px; text-align: right; display: block;">
Toplam Satır Sayısı:
<%# total %>
</div>
</FooterTemplate>
</asp:Repeater>
</div>
<br />
</div>
</ItemTemplate>
</asp:Repeater>
</div>
</form>
</body>
</html>

最佳答案

更新:在您发布更新的代码后,我可以看出问题出在您的 jQuery 代码中。它被设置为在页面加载后立即取消选中所有单选按钮。

您需要更改此设置:

$("input:radio").click(function() {
$("input:radio").each(function() {
$(this).attr("checked", "") //uncheck all radio buttons in page
});
$(this).attr("checked", "checked"); //check only the selected radio
}).attr("checked", ""); //Unchecks all radio buttons when page loads

对此:

$("input:radio").click(function() {
$("input:radio").each(function() {
$(this).attr("checked", "")
});
$(this).attr("checked", "checked");
});

我添加了注释来解释您的 jQuery 代码正在做什么。

关于asp.net - RadioButtonList 回发后未选中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/843479/

26 4 0