开发者

Get value of listitem on postback

开发者 https://www.devze.com 2023-01-24 07:07 出处:网络
I have two listitems and the postback and run a function. <asp:RadioButtonList runat=\"server\" CssClass=\"ccsw\" ID=\"ccsw\" AutoPostBack=\"true\" RepeatDirection=\"Horizontal\" OnSelectedIndexCh

I have two listitems and the postback and run a function.

<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>

And it runs the function 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

I need to find o开发者_Python百科ut which one is checked and then change the text of a label depending on that.

The code I have doesn't work i don't think .Checked works in this instance.

Any idea of how to get the value or text of the listitem?

Thanks


If Me.ccsw.SelectedIndex = 0 Then
   lblPayText.Text = "Payment Amount = £" & Session("strTotal_DebtCharge")
Else
   lblPayText.Text = "Payment Amount = £" & Session("strTotal_Debt")
End If
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号