[控件学习-3]ComponentArt 的脚本注册机制学习

ComponentArt 的脚本注册判断还是很全面的,判断了各种情况,在控件开发学习中还是很值得借鉴的

一样画葫芦练手做了几个简单的控件:

All:SmartTip(改自 ttyp自动提示效果 ) ,自动提示

1.STextBox  =>增加几个属性,只是为了拼Sql的时候字符转义方便些(TrimedText,SqlText,SqlTrimedText)

2.SButton = > 增加几个小属性,象confirm,waitmessage...

3.SImgButton = > 增加鼠标滑过,离开,按下的图片设置

4.SXpButton = > 按模板自动生成三组效果图片(鼠标滑过,离开,按下)

5.SGroupBox =>GroupBox 只有Caption属性,不过设计时写的不好(直接使用了系统的Designer).不直观,不过我自己够用了,改天有空再学习修改Designer

dll: /Files/walkingboy/LangZi.SmartSuite.Web.UI.WebControls.rar

注册代码源代码:

  1 None.gif
  2 ExpandedBlockStart.gifContractedBlock.gif       /**/ /// <summary>
  3InBlock.gif      /// 绘制全局脚本
  4InBlock.gif      /// </summary>
  5InBlock.gif      /// <param name="output"></param>
  6InBlock.gif      /// <param name="sDefaultPath"></param>
  7ExpandedBlockEnd.gif      /// <param name="sScriptFile"></param>

  8 None.gif      protected   void  WriteGlobalClientScript(HtmlTextWriter output,  string  sDefaultPath,  string  sScriptFile)
  9 ExpandedBlockStart.gifContractedBlock.gif     dot.gif {
 10InBlock.gif      string sScript = GenerateClientScriptBlock(sDefaultPath, sScriptFile);
 11InBlock.gif          string sInstanceId = sScriptFile;
 12InBlock.gif
 13InBlock.gif      output.Write(sScript);
 14ExpandedBlockEnd.gif    }

 15 None.gif
 16 None.gif
 17 None.gif    
 18 None.gif
 19 ExpandedBlockStart.gifContractedBlock.gif       /**/ /// <summary>
 20InBlock.gif      /// 获取脚本块
 21InBlock.gif      /// </summary>
 22InBlock.gif      /// <param name="sDefaultPath"></param>
 23InBlock.gif      /// <param name="sScriptFile"></param>
 24ExpandedBlockEnd.gif      /// <returns></returns>

 25 None.gif      private   string  GenerateClientScriptBlock( string  sDefaultPath,  string  sScriptFile)
 26 ExpandedBlockStart.gifContractedBlock.gif     dot.gif {
 27InBlock.gif      string sScript = string.Empty;
 28InBlock.gif      string sScriptLocation = string.Empty;
 29InBlock.gif        //相应版本 主版本+副版本+编译版本
 30InBlock.gif      string sVersionString =
 31InBlock.gif        Assembly.GetExecutingAssembly().GetName().Version.Major.ToString() + "_" +
 32InBlock.gif        Assembly.GetExecutingAssembly().GetName().Version.Minor.ToString() + "_" +
 33InBlock.gif        Assembly.GetExecutingAssembly().GetName().Version.Build.ToString();
 34InBlock.gif        
 35InBlock.gif      if(this.ClientScriptLocation != string.Empty)//指定脚本位置
 36ExpandedSubBlockStart.gifContractedSubBlock.gif      dot.gif{
 37InBlock.gif        sScriptLocation = Path.Combine(Path.Combine(this.ClientScriptLocation, sVersionString), sScriptFile).Replace("\\""/");
 38ExpandedSubBlockEnd.gif            }

 39InBlock.gif      else
 40ExpandedSubBlockStart.gifContractedSubBlock.gif      dot.gif{
 41InBlock.gif        // First, try application config variable
 42InBlock.gif          //首先,先从程序配置文件读取web.config
 43InBlock.gif        string sLocation = ConfigurationSettings.AppSettings["ComponentArt.Web.UI.ClientScriptLocation"];
 44InBlock.gif        if(sLocation != null)
 45ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
 46InBlock.gif            //脚本地址
 47InBlock.gif          sScriptLocation = Path.Combine(Path.Combine(sLocation, sVersionString), sScriptFile).Replace("\\""/");
 48ExpandedSubBlockEnd.gif            }

 49InBlock.gif      
 50InBlock.gif        // Next, try server root
 51InBlock.gif          //IIS根目录
 52InBlock.gif        if(sScriptLocation == string.Empty)
 53ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
 54InBlock.gif          try
 55ExpandedSubBlockStart.gifContractedSubBlock.gif          dot.gif{
 56InBlock.gif            string sStandardRootClientScriptPath = Path.Combine(Path.Combine("/componentart_webui_client", sVersionString), sScriptFile).Replace("\\""/");
 57InBlock.gif
 58InBlock.gif            if(File.Exists(Context.Server.MapPath(sStandardRootClientScriptPath)))
 59ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
 60InBlock.gif              sScriptLocation = sStandardRootClientScriptPath;
 61ExpandedSubBlockEnd.gif            }

 62ExpandedSubBlockEnd.gif          }
 
 63ExpandedSubBlockStart.gifContractedSubBlock.gif          catch dot.gif{}
 64ExpandedSubBlockEnd.gif        }

 65InBlock.gif
 66InBlock.gif        // If failed, try application root
 67InBlock.gif          //程序根目录
 68InBlock.gif        if(sScriptLocation == string.Empty)
 69ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
 70InBlock.gif          try
 71ExpandedSubBlockStart.gifContractedSubBlock.gif          dot.gif{
 72InBlock.gif            string sAppRootClientScriptPath = Path.Combine(Path.Combine(Path.Combine(Page.Request.ApplicationPath, "componentart_webui_client"), sVersionString), sScriptFile).Replace("\\""/");
 73InBlock.gif
 74InBlock.gif            if(File.Exists(Context.Server.MapPath(sAppRootClientScriptPath)))
 75ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
 76InBlock.gif              sScriptLocation = sAppRootClientScriptPath;
 77ExpandedSubBlockEnd.gif            }

 78ExpandedSubBlockEnd.gif          }
 
 79ExpandedSubBlockStart.gifContractedSubBlock.gif          catch dot.gif{}
 80ExpandedSubBlockEnd.gif        }

 81ExpandedSubBlockEnd.gif      }

 82InBlock.gif
 83InBlock.gif      if(sScriptLocation != string.Empty)
 84ExpandedSubBlockStart.gifContractedSubBlock.gif      dot.gif{
 85InBlock.gif        // Do we have a tilde?
 86InBlock.gif        if(sScriptLocation.StartsWith("~"&& Context != null && Context.Request != null)
 87ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
 88InBlock.gif          string sAppPath = Context.Request.ApplicationPath;
 89InBlock.gif          if(sAppPath.EndsWith("/"))
 90ExpandedSubBlockStart.gifContractedSubBlock.gif          dot.gif{
 91InBlock.gif            sAppPath = sAppPath.Substring(0, sAppPath.Length - 1);
 92ExpandedSubBlockEnd.gif          }

 93InBlock.gif
 94InBlock.gif          sScriptLocation = sScriptLocation.Replace("~", sAppPath);
 95ExpandedSubBlockEnd.gif        }

 96InBlock.gif
 97InBlock.gif          //连接外部JS文件
 98InBlock.gif        if(File.Exists(Context.Server.MapPath(sScriptLocation)))
 99ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
100InBlock.gif          sScript = "<script src=\"" + sScriptLocation + "\" type=\"text/javascript\"></script>";
101ExpandedSubBlockEnd.gif        }

102InBlock.gif        else
103ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
104InBlock.gif          throw new Exception(sScriptLocation + " not found");
105ExpandedSubBlockEnd.gif        }

106ExpandedSubBlockEnd.gif      }

107InBlock.gif      else 
108ExpandedSubBlockStart.gifContractedSubBlock.gif      dot.gif{
109InBlock.gif        // If everything failed, emit our internal script
110InBlock.gif          //使用内嵌资源文件
111InBlock.gif        sScript = Utils.DemarcateClientScript(GetResourceContent(sDefaultPath + "." + sScriptFile));
112ExpandedSubBlockEnd.gif      }

113InBlock.gif
114InBlock.gif      return sScript;
115ExpandedBlockEnd.gif    }


转载于:https://www.cnblogs.com/walkingboy/archive/2005/11/25/284506.html

漂亮的ComponentArtWebUI及Demo源码 产品特征: 先进的用户界面控件套装:为高级Web应用程序开发提供了16个优质的用户界面控件。 专为ASP.NET而设计:为三个先进且更强大的框架而设计:ASP.NET 1.0, ASP.NET 2.0和ASP.NET AJAX。 强大的客户端呈现技术:行业最先进的Web用户界面技术。 深入整合ASP.NET AJAX:最理想的完全应用AJAX框架的控件。 全面的帮助文档和技术支持:提供了完善的产品在线帮助文档和全面的技术支持资源。 企业级服务和培训:为企业级项目开发定专门的产品咨询和培训服务。 灵活的产品授权:针对开发者,服务和企业级应用提供不同的授权方式。 ComponentArt Web.UI 2007.1 更新信息 ComponentArt Web.UI 2007.1 版本发布了三个最新的控件: ToolBar for ASP.NET ComboBox for ASP.NET Dialog for ASP.NET 以下为Web.UI组件2007.1版本新增的功能特征: ComponentArt Grid 可以在Callback模式缓存页面 (CallbackCachingEnabled和CallbackCacheSize属性)。 可在Callback模式预加载页面到缓存 (CallbackCacheLookAhead属性)。 页面在滑动条经过时可提取页面 (SliderFetchDelay属性)。 客户端滚动事件。 客户端beforeCallback事件。 ColumnResizeRedistributeWidth属性用于控缩放状态。 ComponentArt Menu 引入(已选)checking和(未选)unchecking项的概念。允许菜单项成为复选框或者单元按钮。 引入(图标透明度)IconVisibility的概念。可使图标只在该项被选或该项根目录时显示。 添加更多对上下文菜单扩展的控:(TopGroupExpandDirection, TopGroupExpandOffsetX, TopGroupExpandOffsetY)。 增加了ExpandDisabledItems的布尔值属性。 改进了IE7的元素覆盖运算法则,优化其执行性能。 ComponentArt MultiPage 增加了IE转换效果 (Transition, TransitionDuration属性)。 Web.UI 2007.1 版本没有进行整体框架的改变,只是在Web.UI 2006.2的基础上进行了改进,所以通过最新的ComponentArt.Web.UI.dll可以很方便的对之前的应用程序进行编译。 ComponentArt Web.UI是全球知名的ASP.NET用户界面控件包,它提供了ComponentArt独特的界面呈现技术,支持强大的AJAX技术,可以为您提供最先进的ASP.NET Web用户界面。ComponentArt Web.UI专为ASP.NET框架设计,它包含16个支持AJAX技术的优质用户界面控件,并可应用在ASP.NET 1.0, ASP.NET 2.0, ASP.NET AJAX框架。 2008年3月27日,专注于ASP.NET Web.UI及Charting控件开发的ComponentArt又发布了Web.UI的最一代版本:2008.1。该版本有四个框架平台:ASP.NET 1.0、ASP.NET 2.0、ASP.NET Ajax,还有当然是最新的.NET框架支持的ASP.NET 3.5了。 2008.1不仅对其代码的运行效率进行了优化,还最增了一个大家期盼已久的成员:Upload。上传空间虽已不是罕见的东东,可是ComponentArt提供的这款不会让你和你的开发团队失望的。 更主要的是ASP.NET 3.5的版本的发布的,同样,特性和功能都具备的同时,也加入了对LINQ的高度支持。这样,ASP.NET 3.5的开发人员也可以享用到这份大餐喽~ Advanced User Interface Control Suite: Includes 19 Premium User Interface controls for development of sophisticated web applications. Built for ASP.NET: Available in four progressively more powerful framework builds: ASP.NET 1.0, ASP.NET 2.0, ASP.NET AJAX and ASP.NET 3.5. Powerful Client-side Rendering Technology: Featuring the most advanced web user interface technology in the industry. Deepest ASP.NET AJAX Integration: The first true controls to fully exploit the most advanced AJAX framework available. Comprehensive Documentation and Support: Featuring complete product documentation online and all-inclusive technical support resources. Enterprise Consulting and Training: Customized consulting and training services are offered to support Enterprise development projects involving larger teams of developers. Flexible Licensing: Available at Developer, Subscription and Enterprise levels. ComponentArt Web.UI 包含以下用户界面控件 Calendar (日历) Grid (表格) Rotator (旋转器) TabStrip (标签) CallBack (回调) Menu (菜单) SiteMap (地图) ToolBar (工具条) ComboBox (组合框) MultiPage (分页) Snap (抓取) TreeView (树形列表) Dialog (对话框) NavBar (导航条) Splitter (框架分离) WebChart Lite (图表) 如果涉及到安装序列号,请填写:3JKX6-YJW6X-GJJDP app_data为应用到的Sql和Access数据库文件 documentation下为官方的相关文档 DllCode下为控件的源码
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值