在回发期间从代码隐藏中不断更新Label

时间:2013-04-30 00:52:32

标签: asp.net vb.net postback

我正在尝试添加一个Label来显示在RadioButtonList,CheckBoxList和DropDownList中所做选择的运行总值。如何将其添加到我当前的代码中?

Protected Sub rblPhone_SelectedIndexChanged(sender As Object, e As EventArgs) Handles rblPhone.SelectedIndexChanged
    lblPhonePrice.Text = "$" & rblPhone.SelectedItem.Value      
End Sub

Protected Sub cblAccessories_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cblAccessories.SelectedIndexChanged
    Dim sumList As Integer = 0
    For Each accessory In cblAccessories.Items
        If accessory.Selected Then
            sumList = sumList + accessory.value
        End If
    Next
    lblAccPrice.Text = "$" & sumList    
End Sub

Protected Sub ddlPlan_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ddlPlan.SelectedIndexChanged
    lblPlanPrice.Text = "$" & ddlPlan.SelectedItem.Value
End Sub

0 个答案:

没有答案