Click here to Skip to main content
14,177,003 members

How to assign checkboxlist in ASP.NET web application.

Member 14083059 asked:

Open original thread
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";


           Lblselected.Text = "0";

Tags: C#, SQL, ASP, WebForms


When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the The Code Project Open License (CPOL).

Advertise | Privacy | Cookies | Terms of Service
Web02 | 2.8.190526.1 | Last Updated 26 Mar 2009
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100