zoukankan      html  css  js  c++  java
  • 复合控件

    1、label。后台编译Span

    (1)ForeColor字体颜色

    (2)设置label的Height,Width之前,必须先设置:Display=“inLine-block”;

    (3)Text:文本内容。

    (4)visible:权限使用

    (5)CssClass:使用的样式表

    2、Literal。后台编译啥也没有

    (1)Text:文本内容。

    但是可以对Literal添加事件。+= Tab Tab

    3、表单元素

    (1)文本元素

    <input type="text" />  工具栏的TextBox的TextMode:SingleLine

    <input type="password" /> 工具栏的TextBox的TextMode:Password

    <input type="textarea" />工具栏的TextBox的TextMode:MultiLine

    <input type="hidden" />设置:display:none

    工具栏的TextBox的TextMode:Color:颜色选择框

    工具栏的TextBox的TextMode:Date:日期格式文本框

    (2)按钮元素

    <input type="button" /> 点击它就是执行赋予的点击事件,不刷新网页

    <input type="submit" />刷新网页,把表单元素的内容提交

    <input type="resit" />不刷新网页,把表单元素的内容清空。

    <input type="image" />刷新网页。

    工具栏的LinkButton:当做有链结的按钮

    ImageButton:当做图片的按钮

    OnClientClick:脚本的点击事件,里面必须写js语言。按钮的OnClientClick是执行客户端脚本(js),客户端执行优先级高于服务端

    (3)复选框元素

    ①<input type="radio">单选

    //工具栏
    <asp:RadioButton ID="RadioButton1" runat="server" GroupName="sex" Text="" /> 
    <asp:RadioButton ID="RadioButton2" runat="server" GroupName="sex" Text="" />
    //表单元素
    <input type="radio"  name="sex" id="nan"/><label for="nan">男</label>
     <input  type="radio" name="sex" id="nv" /><label for="nv">女</label>

    ②<input type="checkbox">多线

    ③<input type="file">路径

    ④<select>下拉框

    <option></option>

    </select>

     复合框要做到三步:(以RadioButtonList为例)

    (1)将数据绑定上去(数据库表为Nation,有NationCode和NationName两列)

    先进封装,设置一个返回List<Nation>的方法

    (2)设置默认选中数据

    (3)竞选中数据取出来。如下代码:

    方法1:

    using System;
    using System.Collections.Generic;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Button1.Click += Button1_Click;//赋予按钮1的点击事件
            if (IsPostBack == false)
            {
                List<Nation> nlist= new NationData().quan();//获取全部内容
                if (IsPostBack == false)//页面重新加载时显示的内容
                {
                    RadioButtonList1.DataSource = nlist;//数据源指向
                    RadioButtonList1.DataValueField = "NationCode";//设置Value值
                    RadioButtonList1.DataTextField = "NationName";//设置显示内容
                    RadioButtonList1.DataBind();//数据最后绑定
                }   
            }
        }
    
        void Button1_Click(object sender, EventArgs e)//按钮1的点击事件
        {
            ListItem li = RadioButtonList1.SelectedItem;//获取选中内容
            Label1.Text = li.Value + li.Text;//输出选中的代号和名字
        }
    }
    View Code

    方法2:

    using System;
    using System.Collections.Generic;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Button1.Click += Button1_Click;//赋予按钮1的点击事件
            if (IsPostBack == false)
            {
                List<Nation> nlist= new NationData().quan();//获取全部内容
                foreach (Nation n in nlist)//用遍历方法,用集合方式添加进去
                {
                    ListItem li = new ListItem(n.NationName, n.NationCode);//设置Text和Value值
                    RadioButtonList1.Items.Add(li);//添加集合
                
                }
                RadioButtonList1.SelectedIndex = 0;//设置默认值
            }
        }
    
        void Button1_Click(object sender, EventArgs e)//按钮1的点击事件
        {
            ListItem li = RadioButtonList1.SelectedItem;//获取选中内容
            Label1.Text = li.Value + li.Text;//输出选中的代号和名字
        }
    }
    View Code

    (4)布局
    RepeatDirection:项的布局方式 Vertical 纵向 Horizontal:横向
    RepeatColumns:规定项的列数
    RepeatLayout:项的布局方式 Table Flow (UnorderedList:无序列表 OrderedList:有序列表 前两种属性无效)。

  • 相关阅读:
    领域驱动设计(DDD)实现之路
    《实现领域驱动设计》译者序
    一次领域驱动设计(DDD)的实际应用
    Gradle学习系列之十——自定义Plugin(本系列完)
    Gradle学习系列之九——自定义Task类型
    Gradle学习系列之八——构建多个Project
    Gradle学习系列之七——依赖管理
    Gradle学习系列之六——使用Java Plugin
    Gradle学习系列之五——自定义Property
    Gradle学习系列之四——增量式构建
  • 原文地址:https://www.cnblogs.com/wwz-wwz/p/5959824.html
Copyright © 2011-2022 走看看