WB list Box

Source: Internet
Author: User

List box HTML code:

<%@ page language= "C #" autoeventwireup= "true" codefile= "Default2.aspx.cs" inherits= "DEFAULT2"%><! DOCTYPE html>

List box background C # code

Using system;using system.collections.generic;using system.linq;using system.web;using System.Web.UI;using System.web.ui.webcontrols;public partial class default2:system.web.ui.page{protected void Page_Load (object sender, E Ventargs e) {if (!            IsPostBack) {Testdatacontext context = new Testdatacontext (); Listbox1.datasource = context.            Nation;            Listbox1.datatextfield = "Name";            Listbox1.datavaluefield = "Code";        Listbox1.databind (); }} protected void button1_click (object sender, EventArgs e) {//Find checked item foreach (ListItem item in Lis Tbox1.items) {if (item. Selected) {if (!                ListBox2.Items.Contains (item)) {LISTBOX2.ITEMS.ADD (item); }}}} protected void Button2_Click (object sender, EventArgs e) {foreach (ListItem ite M in Listbox1.items) {if (! LIstBox2.Items.Contains (item)) {LISTBOX2.ITEMS.ADD (item); }                    }    }}

  

WB list Box

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.