asp.net开发WAP网站及集成在线wap模拟器(5)
ParamRules实现如下: Code [http://www.xueit.com] using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Collections; namespace Rsion.Web{ /// summary ///
ParamRules实现如下:
Code [http://www.xueit.com]
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Collections; namespace Rsion.Web { /// <summary> /// 模板参数规则类 /// </summary> public class ParamRules:IEnumerable { private Dictionary<string, object> rules; public ParamRules() { if (rules == null) rules = new Dictionary<string, object>(); } public object this[string paramKey] { get { if (rules.ContainsKey(paramKey)) return rules[paramKey]; return ""; } set { if (rules.ContainsKey(paramKey)) rules[paramKey] = value; else rules.Add(paramKey, value); } } /// <summary> /// 添加新的规则 /// </summary> /// <param name="paramKey"></param> /// <param name="paramValue"></param> public void Add(string paramKey, object paramValue) { if (rules.ContainsKey(paramKey)) throw new ArgumentException("对不起规则已经存在!Key:" paramKey ",Value:" rules[paramKey].ToString(), "paramKey"); rules.Add(paramKey, paramValue); } public void Remove(string paramKey, object paramValue) { if (rules.ContainsKey(paramKey)) rules.Remove(paramKey); } #region IEnumerable 成员 public IEnumerator GetEnumerator() { foreach (KeyValuePair<string, object> k in rules) { yield return k; } } #endregion } }
Template.cs实现如下:
Code [http://www.xueit.com]
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Rsion.Web { /// <summary> /// 模板 /// </summary> public class Template { public static Template _template; private static ParamRules rules; private Template() { } public static Template CreateInstance() { if (_template == null) _template = new Template(); return _template; } public ParamRules Rules { get { if (rules == null) rules = new ParamRules(); return rules; } } } }
这样我们先在global.asax中填加一些模板数据,这样才可以解析模板,解析模板的功能实现在PageAdapter中,这样可以
在本页面直接调用Html.RenderPartial("template")调用
精彩图集
精彩文章
热门标签
CentOS5.2
soap协议
注
性能计数器
找不到IP
汉字转拼音
winrar
CHTSli
删除表
modify
校验ip
测
非成员函数
特定行
show
文档保存为
post请求
数字格式化
python模块
链接字符串
Assert
V-P交互
listview
程序员
成功
短信猫
C+
print()
ORA-27067
当前
p2p文件传输
php php中通
联想词
php php动态
jpaginate
compre
外观模式
恢复数据库
微信打开网页
加载js文件
光标定位
事务处理
comment命令
超大数据
filecmp
php解压文件
php PHP json
map
nextSibling
操作
搜索结果
内容缓存
二叉树算法
forwarded
生成随机字符
程序多次启动
$(this)
error_report
k均值算法
存取控制
赞助商链接
@CopyRight 2002-2008, 1SOHU.COM, Inc. All Rights Reserved QQ:1010969229

