zoukankan      html  css  js  c++  java
  • AjaxControlToolkit学习笔记

    (1)修改Web.config文件:

    <pages>
       <controls>
        <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
         <add tagPrefix="ajaxToolkit" namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" />
         </controls>
    </pages>

    蓝色标记的是新增的一行,使得增加AjaxControlToolkit控件时,控件的tagPrefix为ajaxToolkit,增加程序可读性。

    (2)AutoCompleteExtender使用:

    关键属性:

    MinimumPrefixLength 开始提供自动完成列表的文本框内最少的输入字符数量

    CompletionInterval 输入字符后响应的时间(以毫秒为单位);

    ServicePath="~/WebServices/WebService1.asmx"  定义所使用的WebServices程序

    ServiceMethod="GetString" 定义WebServices程序的方法,方法的参数、返回值声明必须与下面的示例一致

    [WebMethod]

    public string[] GetString(string prefixText, int count)

    且在WebServices程序中取消对下面行的注释:

     [System.Web.Script.Services.ScriptService]

    (3)CalendarExtender

    关键属性:

    Format="yyyy-MM-dd" 定义用户选择日期后的显示格式

    要使得CalendarExtender控件显示的月份为中文,需为ScriptManager控件定义属性:EnableScriptGlobalization="true" EnableScriptLocalization="true"

    (4)Accordion

          手工编码,动态增加AccordionPane

            protected void Page_Load(object sender, EventArgs e)
            {
                if (!IsPostBack)
                    BindCategory();
            }

            private void BindCategory()//数据为模拟数据
            {
                string[] category = { "计算机", "文学", "经济管理", "建筑" };
                foreach (string s in category)
                {
                    AccordionPane ap = new AccordionPane();
                    ap.ID = s; //AccordionPane的ID必须不同,否则出错。
                    Label lbl = new Label();
                    lbl.Text = s;
                    ap.HeaderContainer.Controls.Add(lbl);
                    for (int i = 1; i < 3; i++)
                    {
                        HyperLink link = new HyperLink();
                        link.Text = s + i.ToString()+"<br/>";
                        ap.ContentContainer.Controls.Add(link);
                    }
                    Accordion1.Panes.Add(ap);
                }            
            }

    如果要页面显示时,所有的AccordionPane都不展开,可以定义Accordion控件的属性:

       RequireOpenedPane="false"
       SelectedIndex="-1"

    (5)Rating

    主要属性:

    CurrentRating="3" MaxRating="5" 
    EmptyStarCssClass="empty" FilledStarCssClass="full" StarCssClass="empty" 
     WaitingStarCssClass="full" AutoPostBack="True" onchanged="Rating1_Changed"

    准备好图片,定义样式:

    .empty
    { background:url(../images/empty.gif); 19px; height:18px}

    .full
    { background:url(../images/star.gif); 19px; height:18px}

    Rating1_Changed事件代码

            protected void Rating1_Changed(object sender, RatingEventArgs e)
            {
                Label1.Text = "你的投票为:" + Rating1.CurrentRating.ToString() + "星";

            }

    (6)MaskedEditValidator

    输入框失去焦点,但未输入时显示提示信息,可设置属性:

    EmptyValueBlurredText="未输入" IsValidEmpty="False"

  • 相关阅读:
    webix datadable 分页重加载
    webix datatale 分頁加载两次
    webix .datatable 表格分页
    webix datatable 列头加tooltip
    webix.tree 修改图标
    webix icon 图标
    spring 模板发送邮件
    spring发QQ邮件
    严重: Context initialization failed org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [cn.itcast.javaee.springmvc.app06.HelloAction] for bean with name '/hello.action' de
    严重: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/springmvc-day01]]
  • 原文地址:https://www.cnblogs.com/zhouhb/p/2032385.html
Copyright © 2011-2022 走看看