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

    1、简单控件

    Label - 边框:1.边框颜色,2.边框样式,3.边框粗细。
    作用:显示文字,编译后的元素span。
    Literal - 作用:显示文字,编译后不会形成任何元素。一般用来从后台输出JS代码

    TextBox - 文字输入框
    TextMode - SingleLine-单行
    MultLine-多行(文本域)
    Password-密码框

    Enabled - 不可用(disabled)
    ReadOnly -只读
    Wrap-自动换行
    MaxLength-最大长度

    Button - 编译后的元素submit
    OnClientClick - 在客户端点击,执行的JS
    confirm-确定对话框,作用是弹出一个可供选择的确定对话框,点击确定之后,他返回ture,点击取消返回flase,可用变量来接收。

    ImageButton -图片按钮
    ImageUrl-选择图片地址

    LinkButton -超链接模样的按钮,

    HyperLink-
    NavigateUrl-导航连接


    简单控件:label Literal TextBoxt Button/ImageButton/LinkButton


    2、webform的数据库连接方式

    App_Code

    没有命名空间一说

    文本类:
    text
    password
    textarea
    hidden

    按钮类:
    button
    submit
    reset
    image


    选择类:
    radio
    checkbox
    file
    select option
    ---------------------------------------------------
    http协议无状态性:
    每一次事件提交,都会将页面刷新,刷新就必走Load事件,重复绑定的情况

    判断页面是第一次加载,还是由已经加载出来的页面中的某个按钮执行了提交返回回来的

    if (!IsPostBack)

    load事件中95%的代码都要写在这里面


    复合控件:
    DropDownList-下拉列表
    一、将数据放进去
    1、DataSource

    DropDownList1.DataSource=new NationData().select();//数据源指向
    DropDownList1.DataTextField="NationName";//显示字段绑定
    DropDownList1.DataValueField="NationCode";//隐藏字段绑定
    DropDownList1.DataBind();

    2、Foreach

    List<Nation>N;ist=new NationData().select();

    foreach(Nation n in Nlist)
    {
    ListItem li=new ListItem(n.NationName,n.NationCode);

    if(li.Value=="N003")
    {
    li.Selected=true;
    }//默认
    DropDownList1.Item.Add(li);
    }


    二、将数据取出来
    1、读取一条数据
    取出value值 - Label1.text=DropDownList1.SelectedValue;
    取出Text值 - Label1.text=DropDownList1.SelectedItem.Text;

    ListBox
    可以多选 - SelectionMode
    2、读取多条选中的数据

    CheckBoxList1-多选
    RepeatDirection-水平垂直排列
    RepeatCoulumns-一行设置几个
    RepeatLayout-有序列表无序列表排列
    RadioButtonList-单选

  • 相关阅读:
    彻底理解 Python 生成器
    Windows上虚拟环境的安装及使用
    github怎么绑定自己的域名
    解决ImportError: cannot import name HTTPSHandler
    服务器(Linux) 安装python3
    函数的参数(必选,默认,可变,关键字)
    python 异常处理(try...finally...和with...as 方法)
    LeetCode 33. 搜索旋转排序数组 | Python
    LeetCode 46. 全排列
    LeetCode 面试题51. 数组中的逆序对
  • 原文地址:https://www.cnblogs.com/weiwenxin01/p/5890209.html
Copyright © 2011-2022 走看看