p; Configuration config = new Configuration(); config.UpdateTabOrder(t.TabId, t.TabOrder); } } 这种方法其实我觉得并不好,只能算是一个新的思路。在OrderTabs()时每次都要循环更新用户配置文件,我觉的还不如,交换序号后在更新用户配置文件。但是用交换序号的方式,要判断是否选中项为第一项(不能上移)或是最后一项(不能下移)。而且程序中还有要将管理项作为最后一项的要求,用交换序号的方式可能又要多写不少代码。可能还有其他的好处我没有想到,所以权衡利弊还是用他的方法吧! 顺便说一个Bug,好像默认提供的程序不能实现上移下移的功能,不知大家遇到了没有。要将Configuration.cs文件中SaveSiteSettings()的方法修改一下才行,修改后的代码: public void SaveSiteSettings() { // 原来的:从Cache中获取站点设置信息数据集(好像是个Bug,因为每次更新数据是更新的HttpContext.Current.Items中的) //SiteConfiguration siteSettings = (SiteConfiguration) HttpContext.Current.Cache["SiteSettings"]; // 修改后的 SiteConfiguration siteSettings = (SiteConfiguration) HttpContext.Current.Items["SiteSettings"]; // 如果Cache中没有,则重新构建 if(siteSettings == null) { // If SaveSiteSettings() is called once, the cache is cleared. If it is // then called again before Global.Application_BeginRequest is called, // which reloads the cache, the siteSettings object will be Null // (这一句不知翻译的对不对,好像很重要)如果SaveSiteSettings()被调用过一次后,Cache就回被清除。如果它再一次被调用在Global.Application_BeginRequest前siteSettings为null则重新写Cache siteSettings = GetSiteSettings(); } string configFile = HttpContext.Current.Server.MapPath(ConfigurationSettings.AppSettings["configFile"]); // Object is evicted from the Cache here. // 将变更后的数据集写入到Xml文件 siteSettings.WriteXml(configFile); } 更多相关内容:点击这里>>
上一页 [1] [2] [Web开发][收藏]ASP.NET Starter Kit 是啥咪碗糕? [Web开发]使用 ASP.NET Community Starter Kit建造网站 [Web开发]解读ASP.NET Portal Starter Kit(1)——数据库篇 [Web开发]利用 ASP.NET Starter Kit 即刻开始 Web 站点开发 [Web开发]解读ASP.NET TimeTracker Starter Kit(2)——重… [Web开发]昨日关注:ASP.NET 2.0 Beta 2 Starter Kits发布 [Web开发]解读ASP.NET Portal Starter Kit(3)——代码文件… [JAVA开发]Weblogic Portal中实现AJAX编程之架构 [JAVA开发]深入WebLogic Portal UI编程 [ORACLE]Oracle Portal及其门户网站开发概述
|