asp:DropDownList 的一些属性

asp:DropDownList 的一些属性使用 BorderStyle 属性为Web服务器控件指定边框样式。 使用一个 BorderStyle 枚举值设置此属性。 下表列出了可能的值。边框样式说明NotSet不设置边框样式。None无边框Dotted虚线边框。

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE稳定放心使用

使用 BorderStyle 属性为 Web 服务器控件指定边框样式。 使用一个 BorderStyle 枚举值设置此属性。 下表列出了可能的值。

边框样式

说明

NotSet

不设置边框样式。

None

无边框

Dotted

虚线边框。

Dashed

点划线边框。

Solid

实线边框。

Double

双实线边框。

Groove

用于凹陷边框外观的凹槽状边框。

Ridge

用于凸起边框外观的突起边框。

Inset

用于凹陷控件外观的内嵌边框。

Outset

用于凸起控件外观的外嵌边框。

 

<%@ Page language="c#" AutoEventWireup="true" %>
<%@ Import Namespace="System.Drawing" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
    private void Page_Load(object sender, System.EventArgs e)
    {
        // Determine whether this is the first time the page is loaded;
        // if so, load the drop-down lists with data.
        if (!Page.IsPostBack)
        {
            // Create a ListItemCollection and add names of colors.
            ListItemCollection colors = new ListItemCollection();
            colors.Add(Color.Black.Name);
            colors.Add(Color.Blue.Name);
            colors.Add(Color.Green.Name);
            colors.Add(Color.Orange.Name);
            colors.Add(Color.Purple.Name);
            colors.Add(Color.Red.Name);
            colors.Add(Color.White.Name);
            colors.Add(Color.Yellow.Name);
            // Bind the colors collection to the borderColorList.
            borderColorList.DataSource = colors;
            borderColorList.DataBind();

            // Create a ListItemCollection and the add names of 
            // the BorderStyle enumeration values.
            ListItemCollection styles = new ListItemCollection();

            foreach (string s in Enum.GetNames(typeof(BorderStyle)))
            {
                styles.Add(s);
            }

            // Bind the styles collection to the borderStyleList.
            borderStyleList.DataSource = styles;
            borderStyleList.DataBind();

            // Create a ListItemCollection and add width values
            // expressed in pixels (px).
            ListItemCollection widths = new ListItemCollection();

            for (int i = 0; i < 11; i++)
            {
                widths.Add(i.ToString() + "px");
            }

            // Bind the widths collection to the borderWidthList.
            borderWidthList.DataSource = widths;
            borderWidthList.DataBind();
        }

    }

    // This method handles the SelectedIndexChanged event for borderColorList.
    public void ChangeBorderColor(object sender, System.EventArgs e)
    {
        // Convert the color name string to an object of type Color, 
        // and set the Color as the new border color for Label1.
        Label1.BorderColor = Color.FromName(borderColorList.SelectedItem.Text);
    }

    // This method handles the selectedIndexChanged event for boderStyleList.
    public void ChangeBorderStyle(object sender, System.EventArgs e)
    {
        // Convert the style name string to a BorderStyle enumeration value,
        // and set the BorderStyle as the new border style for Label1.
        Label1.BorderStyle = (BorderStyle)Enum.Parse(typeof(BorderStyle),
                              borderStyleList.SelectedItem.Text);
    }

    // This method handles the SelectedIndexChanged event for borderWidthList.
    public void ChangeBorderWidth(object sender, System.EventArgs e)
    {
        // Convert the border width string to a object of type Unit,
        // and set the Unit as the new border width for Label1.
        Label1.BorderWidth = Unit.Parse(borderWidthList.SelectedItem.Text);
    }
    </script>
<html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
    <title> Border Properties Example </title>
</head>

    <body>
        <form id="form1" runat="server">

            <h3> Border Properties Example </h3>

            <table border="0" cellpadding="6">
                <tr>
                    <td>
                        <asp:Label Runat="server" BorderColor="Black" 
                            BorderStyle="Solid" BorderWidth="4px" ID="Label1" 
                            Text="Border Properties Example" Height="75" 
                            Width="200"><center><br />Border Properties Example
                            </center></asp:Label>
                    </td>

                    <td>
                        <asp:DropDownList Runat="server" ID="borderColorList" 
                            OnSelectedIndexChanged="ChangeBorderColor" AutoPostBack="True" 
                            EnableViewState="True"></asp:DropDownList>
                        <br />
                        <br />
                        <asp:DropDownList Runat="server" ID="borderStyleList" 
                            OnSelectedIndexChanged="ChangeBorderStyle" AutoPostBack="True" 
                            EnableViewState="True"></asp:DropDownList>
                        <br />            
                        <br />
                        <asp:DropDownList Runat="server" ID="borderWidthList" 
                            OnSelectedIndexChanged="ChangeBorderWidth" AutoPostBack="True"
                            EnableViewState="True"></asp:DropDownList>
                    </td>
                </tr>
            </table>
        </form>
    </body>
</html>

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/181059.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • Hadoop集群搭建,14张过程截图超详细教程

    Hadoop集群搭建,14张过程截图超详细教程作者 大数据小禅 文章简介 本篇文章主要讲解 Hadoop 集群的搭建 为了方便大家理解与操作 关键的步骤博主都进行了截图 减少小伙伴的出错概率 文章源码获取 本文的搭建 PDF 相关安装包 小伙伴们可以关注文章底部的公众号 点击 联系我 备注 Hadoop 搭建获取哦 欢迎小伙伴们点赞 收藏 留言 Hadoop 集群搭建过程 1 Hadoop 简介以及集群规划 2 基础环境准备 3 关闭防火墙 4 配置 IP 地址映射 5 添加 Hadoop 用

    2025年6月1日
    4
  • rtp协议详解

    rtp协议详解RTP的头部格式版本号(V):2比特,用来标志使用的RTP版本。填充位(P):1比特,如果该位置位,则该RTP包的尾部就包含附加的填充字节。扩展位(X):1比特,如果该位置位的话,RTP固定头部后面就跟有一个扩展头部。CSRC计数器(CC):4比特,含有固定头部后面跟着的CSRC的数目。标记位(M):1比特,该位的解释由配置文档(Profile)来承担….

    2022年6月28日
    40
  • 博科Brocade 300光纤交换机配置zone教程

    博科Brocade 300光纤交换机配置zone教程博科Brocade300光纤交换机配置zone教程光纤交换机作为SAN网络的重要组成部分,在日常应用中非常普遍,本次将以常用的博科交换机介绍基本的配置方法。博科300实物图:环境描述:如上图,四台服务器通过各自的双HBA卡连接至两台博科300光纤交换机,IBMV3700为双控制器,每个控制器再分别与两台光纤交换机相连。完成所有的连线及配置工作后,还需对光纤交…

    2022年5月21日
    42
  • 身份证号码大 全_622628是哪里的身份证号码

    身份证号码大 全_622628是哪里的身份证号码7-8 查验身份证 一个合法的身份证号码由17位地区、日期编号和顺序编号加1位校验码组成。校验码的计算规则如下:首先对前17位数字加权求和,权重分配为:{7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2};然后将计算的和对11取模得到值Z;最后按照以下关系对应Z值与校验码M的值:Z:0 1 2 3 4 5 6 7 8 9 10M:1 0 X 9 8 7 6 5 4 …

    2022年8月18日
    7
  • html浅绿色的代码_pr灰度变正常色

    html浅绿色的代码_pr灰度变正常色在每年的一些特殊的日子(比如公祭日等)很多网站会将页面整体去色以灰度形式显示,以示哀悼。这里将对网页中实现该功能进行简单说明。

    2022年9月26日
    4
  • Django(39)使用redis配置缓存[通俗易懂]

    Django(39)使用redis配置缓存[通俗易懂]前言动态网站的基本权衡是,它们是动态的。每次用户请求页面时,Web服务器都会进行各种计算-从数据库查询到模板呈现再到业务逻辑-以创建站点访问者看到的页面。从处理开销的角度来看,这比标准的文件

    2022年7月31日
    13

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号