Asp.net checkboxlist value and check box, check box background control foreground checkbox Selection

Source: Internet
Author: User
Foreground: HTML Code <Asp: checkboxlist id = "cbljl" runat = "server" repeatdirection = "horizontal" width = "100%"> <asp: listitem> current record </ASP: listitem> <asp: listitem> current page </ASP: listitem> <asp: listitem> all records </ASP: listitem> </ASP: checkboxlist> three background methods: first: Obtain the checkbox value C # code string save_cbljl = ""; for (INT I = 0; I <this. cbljl. items. count; I ++) {If (this. cbljl. items [I]. selected = true) {save_cbljl + = This. cbljl. items [I]. value + "," ;}} response. write (save_cbljl); Type 2: Get the checkbox value C # code string str_save_cbljl = ""; foreach (listitem Li in cbljl. items) {If (Li. selected = true) {str_save_cbljl + = Li. value + "," ;}} response. write (str_save_cbljl); 3: Assign C # code string Strapp = "current record, current page, all records,"; string [] strtemp = Strapp to the front-end checkbox from the background. split (','); foreach (string STR in strtemp) {for (INT I = 0; I <cbljl. items. count; I ++) {If (this. cbljl. items [I]. value = Str) {This. cbljl. items [I]. selected = true ;}}}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.