zoukankan      html  css  js  c++  java
  • 使用LINQ取得已选中的CheckBox .

    1. IList<string> FeildList = (from ListItem li in cblFeild.Items where li.Selected select li.Value).ToList();

                string[] UpperIDs = FeildList.ToArray<String>();

    2.  <toolkit:WrapPanel Name="wrpContainer" >

                       <CheckBox Content="CheckBox1" Height="16" Name="checkBox1" Margin="20" FontSize="14" />

                      <CheckBox Content="CheckBox2" Height="16" Name="checkBox2" Margin="20" FontSize="14" />

                      <CheckBox Content="CheckBox3" Height="16" Name="checkBox3" Margin="20" FontSize="14" />

                      <CheckBox Content="CheckBox4" Height="16" Name="checkBox4" Margin="20" FontSize="14"/>

                      <CheckBox Content="CheckBox6" Height="16" Name="checkBox6" Margin="20" FontSize="14" />

                      <CheckBox Content="CheckBox7" Height="16" Name="checkBox7" Margin="20" FontSize="14" />

                      <CheckBox Content="CheckBox8" Height="16" Name="checkBox8" Margin="20" FontSize="14" />

                      <CheckBox Content="CheckBox9" Height="16" Name="checkBox9" Margin="20" FontSize="14" />

                       <CheckBox Content="CheckBox10" Height="16" Name="checkBox10" Margin="20" FontSize="14" />

    </toolkit:WrapPanel>

      var checkedItems = wrpContainer.Children.OfType<CheckBox>().Where( c => c.IsChecked == true );

      MessageBox.Show( string.Format( "有 {0}个选项已选择 " , checkedItems.Count().ToString() ) );
  • 相关阅读:
    基于bootstrap分页
    encache学习教程
    java异常和spring事务注解
    JSP自定义标签开发入门
    spring junit
    vs与数据库连接查询
    winfrom文本文档打开
    面向对象 封装
    面向对象 概念
    DW 游记代码
  • 原文地址:https://www.cnblogs.com/sisiblog/p/2969671.html
Copyright © 2011-2022 走看看