Calendar控件 

使用案例:

在Default.aspx中:

 <div>

   <h1>Calendar控件</h1>

     <asp:Calendar ID="Calendar1" runat="server" BackColor="#FFFFCC" BorderColor="#FFCC66" BorderWidth="1px" 

                 DayNameFormat="Shortest" Font-Names="VerDana" Font-Size="8pt" ForeColor="#663399" Height="300px"

                 ShowGridLines="true" width="400px" OnDayRender="Calendar1_DayRender" OnSelectionChanged="Calendar1_SelectionChanged" 

       OnVisibleMonthChanged="Calendar1_VisibleMonthChanged">

                 <SelectedDayStyle BackColor="#CCCCFF" Font-Bold="true"/>

                 <SelectorStyle BackColor="#FFCC66"/>

                 <TodayDayStyle BackColor="#FFCC66" ForeColor="White"/>

                 <OtherMonthDayStyle BackColor="#CC9966"/>

                 <NextPrevStyle Font-Size="9pt" ForeColor="#FFFFCC"/>

                 <DayHeaderStyle BackColor="#FFCC66" Font-Bold="true" Height="1px"/>

                 <TitleStyle BackColor="#660000" Font-Bold="true" Font-Size="9pt" ForeColor="#FFFFCC"/>

             </asp:Calendar>

   <br/>

   <br/>

   <asp:Label ID="Label1" runat="server"/>

 </div>

在Default.aspx.cs中:

 protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
  //定义假日显示样式1
  Style vacStyle1 = new Style();
  vacStyle1.BackColor = System.Drawing.Color.Violet;
  vacStyle1.BorderColor = System.Drawing.Color.Wheat;
  vacStyle1.BorderWidth = ;   //定义假日显示样式1
  Style vacStyle2 = new Style();
  vacStyle2.BackColor = System.Drawing.Color.Red;
  vacStyle2.BorderColor = System.Drawing.Color.PaleVioletRed;
  vacStyle2.BorderWidth = ;   //定义周末显示样式
  Style weekStyle = new Style();
  weekStyle.BackColor = System.Drawing.Color.Gold;
  string title1 = "十一长假";//假日提示内容
  string title2 = "中秋节";   if ((e.Day.Date == new DateTime(, , )))
  {
    //应用样式到假日
    e.Cell.ApplyStyle(vacStyle2);
    //定义假日显示内容,并为假日提供链接
    Label Label1 = new Label();
    Label1.Text = "<br>" + "<a href=" + e.SelectUrl + ">" + title2 + "</a>";
    e.Cell.Controls.Add(Label1);
  }   if ((e.Day.Date >= new DateTime(, , )) && (e.Day.Date <= new DateTime(, , )))
  {
    //应用样式到假日
    e.Cell.ApplyStyle(vacStyle1);
    //定义假日显示内容,并为假日提供链接
    Label Label1 = new Label();
    Label1.Text = "<br>" + "<a href=" + e.SelectUrl + ">" + title1 + "</a>";
    e.Cell.Controls.Add(Label1);
  }
  else if (e.Day.IsWeekend)
    e.Cell.ApplyStyle(weekStyle);   DateTime mytime = new DateTime(, , );
  if (e.Day.Date == mytime)
    e.Day.IsSelectable = true;
  else
    e.Day.IsSelectable = false;
 } protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
  this.Label1.Text = "今天是:" + this.Calendar1.TodaysDate.ToShortDateString() + "<br>" + "你选择的日期是:"+
    this.Calendar1.SelectedDate.ToShortDateString();
} protected void Calendar1_VisibleMonthChanged(object sender, MonthChangedEventArgs e)
{
  if (e.NewDate.Month > e.PreviousDate.Month)
  {
    this.Label1.Text = "下一个月";
  }
  else
  {
    this.Label1.Text = "上一个月";
  }
}

AdRotator控件

读取XML文件中的广告信息

在AdRotator1.ad中:

 <Advertisements xmlns="http://schemas.microsoft.com/AspNet/AdRotator-Schedule-File">
<Ad xmlns="">
<ImageUrl>~/Images/Sunset.jpg</ImageUrl>
<AlternateText>落日</AlternateText>
<Impressions>80</Impressions>
</Ad>
<Ad xmlns="">
<ImageUrl>~/Images/Water hills.jpg</ImageUrl>
<AlternateText>荷塘</AlternateText>
<Impressions>60</Impressions>
</Ad>
<Ad xmlns="">
<ImageUrl>~/Images/Winter.jpg</ImageUrl>
<AlternateText>冰山</AlternateText>
<Impressions>90</Impressions>
</Ad>
</Advertisements>

在Default.aspx中:

 <div>
  <asp:AdRotator ID="AdRotator1" runat="server"AdvertisementFile="~/App_Data/AdRotator1.ad" />
</div>

读取数据库文件中的广告信息

在Web.config中:

 <connectionStrings>
  <add name="ConnectionString1" connectionString="Data Source=追风的蜗牛;Initial Catalog=Adrotator;Integrated Security=True"/>
</connectionStrings>

在Dfault.aspx.cs中:

 <div>
  <asp:AdRotator ID="AdRotator1" runat="server" DataSourceID="SqlDataSource1" />
  <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ConnectionStrings:ConnectionString1%>"
    SelectCommand="SELECT [ID],[ImageUrl],[NavigateUrl],[Impressions],[AlternateText] FROM Advertisements">
  </asp:SqlDataSource>
</div>

MultiView和View控件

在Default.aspx中:

 <div>
  <asp:Label Text="请选择显示样式:" runat="server"></asp:Label>
  <br/>
  <asp:RadioBUtton ID="RadioButton1" runat="server" AutoPostBack="true" Text="样式1" GroupName="Group1"
    OnCheckedChanged="RadioButton_CheckedChanged" />
  <asp:RadioButton ID="RadioButton2" runat="server" AutoPostBack="true" Text="样式2" GroupName="Group1"
    OnCheckedChanged="RadioButton_CheckedChanged" />
  <hr/>
  <asp:MultiView ID="MultiView1" runat="server">
    <asp:View ID="View1" runat="server">
      <asp:Label ID="Label1" Text="样式一" runat="server"></asp:Label>
    </asp:View>
    <asp:View ID="View2" runat="server">
      <asp:Label ID="Label2" Text="样式二" runat="server"></asp:Label>
    </asp:View>
  </asp:MultiView>
</div>

在Default.aspx.cs中:

 protected void RadioButton_CheckedChanged(object sender, EventArgs e)
{
  if (this.RadioButton1.Checked)
    MultiView1.ActiveViewIndex = ;
  else if (this.RadioButton2.Checked)
    MultiView1.ActiveViewIndex = ;
}

Wizard控件

在Default.aspx中:

 <div>
  <asp:Wizard ID="Wizard1" runat="server">
    <WizardSteps>
      <asp:WizardStep Title="step1" runat="server">
        <asp:Label runat="server" Text="姓名:"/>
        <asp:TextBox ID="TextBox1" runat="server"/>
      </asp:WizardStep>
      <asp:WizardStep Title="step2" runat="server">
        <asp:Label runat="server" Text="性别:"/>
        <asp:TextBox runat="server" ID="TextBox2"/>
      </asp:WizardStep>
      <asp:WizardStep Title="step3" runat="server">
        <asp:Label runat="server" Text="电话:"/>
        <asp:TextBox ID="TextBox3" runat="server" />
      </asp:WizardStep>
    </WizardSteps>
  </asp:Wizard>
</div>

Rich控件二的更多相关文章

  1. QRowTable表格控件(二)-红涨绿跌

    目录 一.开心一刻 二.概述 三.效果展示 四.任务需求 五.指定列排序 六.排序 七.列对其方式 八.相关文章 原文链接:QRowTable表格控件(二)-红涨绿跌 一.开心一刻 一天,五娃和六娃去 ...

  2. Windows高DPI系列控件(二) - 柱状图

    目录 一.QCP 二.效果展示 三.高DPI适配 1.自定义柱状图 2.新的柱状图 3.测试代码 四.相关文章 原文链接:Windows高DPI系列控件(二) - 柱状图 一.QCP QCP全称QCu ...

  3. jquery 分页控件(二)

    上一章主要是关于分页控件的原理,代码也没有重构.在这一章会附上小插件的下载链接,插件主要就是重构逻辑部分,具体可以下载源文件看下,源代码也有注释.为了测试这个插件是能用的,我弄了个简单的asp.net ...

  4. WPF 自定义分页控件二

    一:添加自定义分页控件,命名为KDataPagerTwo: public class KDataPagerTwo : Control, INotifyPropertyChanged { static ...

  5. Pmw大控件(二)

    Pmw大控件英文名Pmw Python megawidgets 官方参考文档:Pmw 1.3 Python megawidgets 一,如何使用Pmw大控件 下面以创建一个计数器(Counter)为例 ...

  6. ExtJS基础知识总结:自定义日历和ComboBox控件(二)

    概述 1.ExtJS 5不支持日期选择框中只选择年月,为了满足ExtJs5可以实现选择年月的功能,查询网上资料,整理出来了相应的处理方式,最终实现的效果如下图: 2.ExtJS 控件丰富,如果需要实现 ...

  7. QT 常用控件二

    QT提供QHBoxLayout类.QVBoxlayout类及QGridLayout类等的基本布局管理,分别是水平排列布局,垂直排列布局和网格排列布局 addWidget()方法用于向布局中加入需要布局 ...

  8. Rich控件一

    Calendar控件 Calendar控件用来在Web页面中显示日历中的可选日期,并显示与特定日期关联的数据. 控件声明代码如下: <asp: Calendar id=" Calend ...

  9. ASP.NET验证控件二

    RequiredFieldValidator 验证控件 页面布局: <div> <h1>RequiredFieldValidator 验证控件</h1>   用户名 ...

随机推荐

  1. ylbtech-LanguageSamples-Struct(结构)

    ylbtech-Microsoft-CSharpSamples:ylbtech-LanguageSamples-Struct(结构) 1.A,示例(Sample) 返回顶部 “结构”示例 本示例演示结 ...

  2. java多线程之计算数量

    package Thread.Abort; import java.util.ArrayList; import java.util.List; import java.util.Random; im ...

  3. R中根据匹配原则将一列拆分为几列的方法

    例如我们需要将一下数据的第二列从and处拆分为两列: before = data.frame(attr = c(1,30,4,6), type=c('foo_and_bar','foo_and_bar ...

  4. Haproxy安装及配置(转)

    1.安装 # wget http://haproxy.1wt.eu/download/1.3/src/haproxy-1.3.20.tar.gz # tar zcvf haproxy-1.3.20.t ...

  5. java -d64

    在 resin启动时指定java时加上了 -d64选项 JAVA="/xx/java -d64" 选择 "-server"选项必须使用-d64 http://b ...

  6. Dubbo的Maven打包

    Maven项目的依赖,我们可以通过下面命令看到,打包时,会按照这个依赖编译进去对应模块. 参考:http://www.cnblogs.com/ghj1976/p/5336923.html mvn de ...

  7. 使用jaxp对比xml进行SAX解析

    package cn.itcast.sax; import java.io.IOException; import javax.xml.parsers.ParserConfigurationExcep ...

  8. (整理).net实现条形码与二维码

    本文由来源网络的知识点组合而成,感谢分享的作者,文章结尾处给出查询资料连接. 条形码(barcode)是将宽度不等的多个黑条和空白,按照一定的编码规则排列,用以表达一组信息的图形标识符.常见的条形码是 ...

  9. ubuntu中VNC的安装配置笔记

    使用服务器时,利用远程桌面是非常方便的,否则需要跑到服务器机房操作非常的费事,或者需要远程操作机器是也可以使用,一般的操作系统都会带有远程桌面功能,但是不如第三方的的软件好用,对于linux系统常用的 ...

  10. 06-CABasicAnimation基础核心动画

    *:first-child { margin-top: 0 !important; } body > *:last-child { margin-bottom: 0 !important; } ...