Get value of listitem on postback
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
精彩评论