asp.net Coolite 学习交流

Coolite Toolkit
简介
Coolite Toolkit 是一个支持ASP.NET AJAX的Web控件。
Coolite Toolkit是基于跨浏览器的ExtJS 库开发而来的,并且简化了开发步骤,并且包含有丰富的Ajax运用。
Coolite Toolkit和ExtJS 都是开源的。
官方主页:http://coolite.com
下载地址:http://coolite.com/download
Samples: http://examples.coolite.com

而且我在cnblogs 建立了小组,用cnblogs的可以去加入:http://space.cnblogs.com/group/coolite/   (csdn 管理员不要踢我  -  。-!)

另外最近我加入了讨论Coolite的Q群:86399374

先给那些没有用过ExtJs 或 Coolite 的朋友打一下预防针-- 很多人都知道extjs控件又大又慢,但因为它界面美观,ajax+json操作简单方便,因此作为企业应用还是不错的选择。而Coolite基于extjs,因此无可避免也是继承这个缺点(我现在用的0.7版本的dll有6M多)。但是用了Coolite,你就可以省掉一大串那样管理的js代码了,界面完全可以用它来简单配置就得到很cool的效果,js只是作为少量的客户端操作。

Coolite最大不足是:还是开发阶段,bug不少。

废话少说,给你一个简单的ajax例子,你就明白为什么我喜欢它了:

1. AjaxEvet:

//这是一个服务端方法

  protected void UpdateTimeStamp(object sender, AjaxEventArgs e)
{
this.SetTime();
}

//Html 调用上述方法
<ext:Button ID="Button1" runat="server" Text="Click Me">
<AjaxEvents>
<Click OnEvent="UpdateTimeStamp">
<EventMask ShowMask="true" MinDelay="500" Msg="Updating TimeStamp..." />
</Click>
</AjaxEvents>
</ext:Button>

OnEvent="UpdateTimeStamp" 就是指点击按钮后调用服务端方法UpdateTimeStamp 来更新某个标签的时间

2. AjaxMethod:

<script runat="server">
[AjaxMethod]
public void SetTimeStamp()
{
this.Label1.Text = string.Concat("Server Time: ", DateTime.Now.ToLongTimeString());
}
</script>

<ext:Button ID="Button5" runat="server" Text="Click Me" Icon="Lightning">
<Listeners>
<Click Handler="Coolite.AjaxMethods.SetTimeStamp();" />
</Listeners>
</ext:Button>

第一次用coolite的人基本都会漏掉配置这一至关重要的环节。

如果想开启ajax事件,请记得在web.config 里做以下配置:

<httpHandlers>
      <add path="*/coolite.axd" verb="*" type="Coolite.Ext.Web.ResourceManager" validate="false"/>      
    </httpHandlers>

<httpModules>     
      <add name="AjaxRequestModule" type="Coolite.Ext.Web.AjaxRequestModule, Coolite.Ext.Web"/>
    </httpModules>

<modules>
      <!--Coolite Config-->
      <add name="AjaxRequestModule" preCondition="managedHandler" type="Coolite.Ext.Web.AjaxRequestModule, Coolite.Ext.Web"/>
    </modules>

<handlers>
      <!--Coolite Config-->
      <add name="AjaxRequestHandler" verb="*" path="*/coolite.axd" preCondition="integratedMode" type="Coolite.Ext.Web.ResourceManager"/>
    </handlers>

官方关于配置的详细说明文件:

--------------------------------------------------------------------------
                         SAMPLE WEB.CONFIG
--------------------------------------------------------------------------

<?xml version="1.0"?>
<configuration>
  <configSections>
    <section name="coolite" type="Coolite.Web.UI.GlobalConfig" requirePermission="false" />
  </configSections>

<!-- 
      COOLITE GLOBAL CONFIGURATION PROPERTIES

ajaxEventUrl : string
          The url to request for all AjaxEvents.
          Default is "".

ajaxMethodProxy : ClientProxy
          Specifies whether server-side Methods marked with the [AjaxMethod] attribute will output configuration script to the client.
          If false, the AjaxMethods can still be called, but the Method proxies are not automatically generated.
          Specifies ajax method proxies creation. The Default value is to Create the proxy for each ajax method.
          Default is 'Default'. Options include [Default|Include|Ignore]

ajaxViewStateMode : ViewStateMode
          Specifies whether the ViewState should be returned and updated on the client during an AjaxEvent.
          The Default value is to Exclude the ViewState from the Response.
          Default is 'Default'. Options include [Default|Exclude|Include]

cleanResourceUrl : boolean
          The Coolite controls can clean up the autogenerate WebResource Url so they look presentable.       
          Default is 'true'. Options include [true|false]

clientInitAjaxMethods : boolean
          Specifies whether server-side Methods marked with the [AjaxMethod] attribute will output configuration script to the client.
          If false, the AjaxMethods can still be called, but the Method proxies are not automatically generated.
          Default is 'false'. Options include [true|false]

gzip : boolean
          Whether to automatically render scripts with gzip compression.       
          Only works when renderScripts="Embedded" and/or renderStyles="Embedded".      
          Default is true. Options include [true|false]

scriptAdapter : string
          Gets or Sets the current script Adapter.    
          Default is "Ext". Options include [Ext|jQuery|Prototype|YUI]

renderScripts : ResourceLocationType
          Whether to have the coolite controls output the required JavaScript includes or not.      
          Gives developer option of manually including required <script> files.       
          Default is Embedded. Options include [Embedded|File|None]

renderStyles : ResourceLocationType
          Whether to have the coolite controls output the required StyleSheet includes or not.      
          Gives developer option of manually including required <link> or <style> files.      
          Default is Embedded. Options include [Embedded|File|None]

resourcePath : string
          Gets the prefix of the Url path to the base ~/Coolite/ folder containing the resources files for this project.
          The path can be Absolute or Relative.

scriptMode : ScriptMode
          Whether to include the Release (condensed) or Debug (with inline documentation) Ext JavaScript files.      
          Default is "Release". Options include [Release|Debug]

sourceFormatting : boolean
          Specifies whether the scripts rendered to the page should be formatted. 'True' = formatting, 'False' = minified/compressed.
          Default is 'false'. Options include [true|false]

stateProvider : StateProvider
          Gets or Sets the current script Adapter.
          Default is 'PostBack'. Options include [PostBack|Cookie|None]

theme : Theme
          Which embedded theme to use.      
          Default is "Default". Options include [Default|Gray|Slate]

quickTips : boolean
          Specifies whether to render the QuickTips. Provides attractive and customizable tooltips for any element.
          Default is 'true'. Options include [true|false]
  -->

<coolite theme="Default" />

<!--
      The following system.web section is only requited for running ASP.NET AJAX under Internet
      Information Services 6.0 (or earlier).  This section is not necessary for IIS 7.0 or later.
  -->
  <system.web>
      <httpHandlers>
      <add path="*/coolite.axd" verb="*" type="Coolite.Ext.Web.ResourceManager" validate="false" />
    </httpHandlers>
      <httpModules>
          <add name="AjaxRequestModule" type="Coolite.Ext.Web.AjaxRequestModule, Coolite.Ext.Web" />
      </httpModules>
  </system.web>

<!--
      The system.webServer section is required for running ASP.NET AJAX under Internet Information Services 7.0.
      It is not necessary for previous version of IIS.
  -->
    <system.webServer>
        <validation validateIntegratedModeConfiguration="false"/>
        <modules>
            <add name="AjaxRequestModule" preCondition="managedHandler" type="Coolite.Ext.Web.AjaxRequestModule, Coolite.Ext.Web" />
        </modules>
        <handlers>
            <add name="AjaxRequestHandler" verb="*" path="*/coolite.axd" preCondition="integratedMode" type="Coolite.Ext.Web.ResourceManager"/>
        </handlers>
    </system.webServer>
</configuration>

(0)

相关推荐

  • asp.net 学习之路 项目整体框架简单的搭建

    最近刚学了些关于asp.net mvc方面的知识,于是了要拿个小项目来练练手,提高下自己的code能力跟思维能力.在此之前做东西都很简单,直接用动软那一套生成代码,生成一个简单的三层架构作为项目整体的框架,数据库访问层用的是ado.net.这么做了感觉挺麻烦,如果要项目要换数据库,要给数据库增加表或者给表增加某个字段,或者不使用ado.net用个orm框架来访问数据库等等,这样整体项目该动起来就提别的麻烦,为了解决这一些问题我们需要重新思考怎么搭建. 关于数据库访问层 数据库访问驱动层--大家都

  • 一天精通asp.net的学习经验小结

    1.Validator 2.IsPostBack 3.AutoPostBack.控件离开焦点的时候自动Post. 4.repeater控件的使用.:Repeater控件比以前版本的asp.net好用了,只要 Eval就可以了,不用DataBinder.Eval(container.DataItem,"***"):了,只要Eval("Name")就可以,注意不能丢了前面的"#". <asp:Repeater ID="Repeater

  • ASP.NET预备知识学习笔记

    .NET FrameWork框架 是一套应用程序开发框架,主要目的提供一个开发模型. 主要的两个组件:     公共语言运行时(Common Language Runtime)(CLR): 提供内存管理.线程管理和远程处理等核心服务,并且还强制实施严格的安全类型,提高代码的安全性和可靠想. .NET  Framework类库: 与CLR紧密集成,可以使用它开发多种应用程序和服务.主要包括控制台应用程序.Windows窗体应用程序.WindowsPresentationFoundation(WPF

  • asp.net自定义控件代码学习笔记

    效果:在放这个控件的页面: XML/HTML 复制代码 代码如下: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="test6.aspx.cs" Inherits="test6" %> <%@Register TagPrefix="custom" Namespace="myComponents" %>

  • asp.net Linq to Xml学习笔记

    加上之前学习过Linq to Entity,因此学习起来也比较随心应手. 以下是项目中某个底层的代码,记下做个备忘,如果能给新手学习Linq to Xml带来帮助,那就再好不过了 XML文件的格式: 复制代码 代码如下: <?xml version="1.0" encoding="utf-8"?> <configuration> <OPsystemConfig> <MemberCenter> <DomainNam

  • ASP.NET的事件模型(很适合学习的文章)

    在Default.aspx的页面中第一行是一条页面指令: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="AspxEventsModel._Default" %> 其中CodeBehind属性指定代码隐藏页面的名称,Inherits指定所属的命名空间和类,AutoEventWireup属性是可以

  • ASP.NET MVC学习笔记

    网上关于ASP.NET MVC的系列教程有好几个,所以就不从头开始介绍了,结尾处给大家推荐了几个链接,需要的话可以从头系统的看看. 1.ASP.NET MVC介绍及与ASP.NET WebForm的区别 刚开始为了搞清楚ASP.NET MVC到底值不值得用,翻来覆去想了一个多礼拜,看了好多资料和评论,最后决定还是值得一用.MVC不是一个简单的设计模式,更像一种架构模式,或者一种思想,刚开始一听MVC想到的就是模板引擎,NVelocity,StringTempleate等,但感觉如果只是为了用模板

  • ASP.NET的HtmlForm控件学习及Post与Get的区别概述

    一.前言 1.了解HTTP(hypertext transport protocol)超文本传输协议 它是一种分布式,协作式,超媒体系统应用之间的通信协议.是万维网(world wide web)交换信息的基础.它以HTML文档从web服务器传到web浏览器的方式进行的,如下图解: HTTP工作在TCP/IP协议体系中的TCP协议上.我们可以引出TCP/IP协议层级模型,如下图: HTTP请求的方法如下:(1).OPTIONS:返回服务器针对特定资源所支持的HTTP请求方法.也可以利用向Web服

  • 写给初学asp.net的新人们 新手学习经验

    关于书本 新人们常常会说我看了多少多少的书,看过某某人写的书,仿佛书看了就会做了.其实不然,很多新人在面试的时候夸夸其谈,说啥啥都知道一点,到真正做的时候,啥都不会.归根到底是没有经验,技术这玩意儿经验非常重要,很多东西如果不是你碰到了,你从书上一辈子都找不到答案. 我看书的习惯一般都是先把整个书翻翻,了解一下书的基本内容,然后在实际项目中遇到相应的问题再去翻书,当然这是因为我对技术已经有一定的了解,不需要通读整本书.初学者应该找一些适合自己的书,通读一遍,其中的例子要认真做,一定要自己去写代码

  • Asp.net回调技术Callback学习笔记

    .aspx: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xht

  • ASP.NET学习路线(详细)

    在此就向打算系统学习ASP.NET技术的初学者谈谈我的建议. 如果你已经有较多的面向对象开发经验,跳过以下这两步: 第一步 掌握一门.NET面向对象语言,C#或VB.NET. 我强烈反对在没系统学过一门面向对象(OO)语言的前提下去学ASP.NET. ASP.NET是一个全面向对象的技术,不懂OO,那绝对学不下去! 第二步 对.NET Framework类库有一定的了解 可以通过开发Windows Form应用程序来学习.NET Framework.ASP.NET是建构在.NET Framewo

随机推荐