如何在ASP.NET Web应用程序中分配checkboxlist。 [英] How to assign checkboxlist in ASP.NET web application.

查看:81
本文介绍了如何在ASP.NET Web应用程序中分配checkboxlist。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hii..i有CheckboxList,其中我有5个复选框 - 选择全部,空手道,跆拳道,功夫,瑜伽。我想当用户选中第一个选项全选,然后自动选择所有复选框并显示在标签消息15000.And如果用户逐个检查,即检查空手道,然后消息显示5000 ......等等。或者用户如果喜欢空手道和瑜伽信息显示,空手道的费用总额为5000,瑜伽费为3000,那么应该显示8000.

请帮帮我......你好



我尝试过:



Hii..i have CheckboxList in which i have 5 checkbox-Select All,Karate,Kickboxing,Kung Fu,Yoga. I want when user checked first option "Select All" then all checkboxses selected automatically and show in label message 15000.And if user checked one by one i.e checked Karate then message shows 5000...and so on.Or user chcked if like Karate and Yoga message shows the total sume of Fees like Karate fees is 5000 and yoga fees is 3000 then it should be show 8000.
Please help me ...Thnk u

What I have tried:

protected void CheckBoxList1_SelectedIndexChanged(object sender, EventArgs e)
   {
       if (CheckBoxList1.SelectedItem.ToString() == "Select All")
       {
           Lblselected.Text = "15000";

       }
       else if (CheckBoxList1.SelectedItem.ToString() == "Karate")
       {
           Lblselected.Text = "4000";

       }
       else if (CheckBoxList1.SelectedItem.ToString() == "Kickboxing")
       {
           Lblselected.Text = "6000";

       }

       else if (CheckBoxList1.SelectedItem.ToString() == "Kung Fu")
       {
           Lblselected.Text = "3500";

       }
       else if (CheckBoxList1.SelectedItem.ToString() == "Yoga")
       {
           Lblselected.Text = "1500";

       }

       else
       {
           Lblselected.Text = "0";

       }
   }

推荐答案

查看 CheckBoxList类(System.Web.UI.WebControls) | Microsoft Docs [ ^ ]。


这篇关于如何在ASP.NET Web应用程序中分配checkboxlist。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆