【发布时间】:2016-12-01 02:31:02
【问题描述】:
我需要一些帮助。我在下面有一个复选框列表。
<asp:Label ID="Label107" runat="server" Text="General Patient Teaching Methods Used/Information Given (Check all that apply)" CssClass="rdbBlock"></asp:Label>
<asp:CheckBoxList ID="CheckBoxList6" runat="server" CssClass="rdbBlock">
<asp:ListItem Text=" <span style=font-weight:normal;>Patient/Caregiver observed</span>" Value="Patient/Caregiver observed"></asp:ListItem>
<asp:ListItem Text=" <span style=font-weight:normal;>Disease process</span>" Value="Disease process"></asp:ListItem>
<asp:ListItem Text=" <span style=font-weight:normal;>Nursing visit frequecy</span>" Value="ursing visit frequecy"></asp:ListItem>
<asp:ListItem Text=" <span style=font-weight:normal;>Supply management</span<" Value="Supply management"></asp:ListItem>
<asp:ListItem Text=" <span style=font-weight:normal;>Emergency Procedures</span>" Value="Emergency Procedures"></asp:ListItem>
<asp:ListItem Text=" <span style=font-weight:normal;>24 phone number</span>" Value="24 phone number"></asp:ListItem>
<asp:ListItem Text=" <span style=font-weight:normal;>Right/Responsibility</span>" Value="Right/Responsibility"></asp:ListItem>
<asp:ListItem Text=" <span style=font-weight:normal;>Reviewed infusion admission packet</span>" Value="Reviewed infusion admission packet"></asp:ListItem>
</asp:CheckBoxList>
我想要做的是从选定的 ListItems 中获取值并将值设置为标签。我想使用 JavaScript/JQuery,但我想不通。
这是我在 TextBoxes 上使用的,它可以工作,但文本框没有要收集的多个选择项。
是的 - 非常重要 - 没有回帖!!!!
<script type="text/javascript">
function setLabelText9(e) {
e.preventDefault(); // To prevent postback
var txtValue = $('#<%=txtCaregiverHelper.ClientID%>').val();
$('#<%=Label286.ClientID%>').html(txtValue);
}
function getLabelText9(e) {
e.preventDefault(); // To prevent postback
alert($('#<%=Label286.ClientID%>').html());
}
</script>
期望的结果: 如果 CheckBoxList ListItem(使用索引)0、3、5 被选中,则将标签设置为索引 0、3、5 中的选定值。我可以将一些值连接在一起,使其看起来与空格和标点符号正确。我只需要 javascript/jquery 代码的帮助来收集所有值并将它们存储在标签文本中。
谢谢
【问题讨论】:
标签: javascript c# jquery asp.net