0

我有两个列表项和回发并运行一个函数。

<asp:RadioButtonList runat="server" CssClass="ccsw" ID="ccsw" AutoPostBack="true" RepeatDirection="Horizontal" OnSelectedIndexChanged="UpdateCharges">
    <asp:ListItem Text="Credit Card"></asp:ListItem>
    <asp:ListItem Text="Debit Card"></asp:ListItem>
  </asp:RadioButtonList>

它运行功能UpdateCharges

Sub UpdateCharges(ByVal sender As Object, ByVal e As System.EventArgs)

If ccsw_1.Checked Then

    lblPayText.Text = "Payment Amount = £" & Session("strTotal_DebtCharge")

Else

    lblPayText.Text = "Payment Amount = £" & Session("strTotal_Debt")

End If

End Sub

我需要找出哪个被选中,然后根据它更改标签的文本。

我的代码不起作用我认为.Checked在这种情况下不起作用。

知道如何获取列表项的值或文本吗?

谢谢

4

1 回答 1

1
If Me.ccsw.SelectedIndex = 0 Then
   lblPayText.Text = "Payment Amount = £" & Session("strTotal_DebtCharge")
Else
   lblPayText.Text = "Payment Amount = £" & Session("strTotal_Debt")
End If
于 2010-11-11T09:03:18.410 回答