

























在微软的WebCast下载了有关WebPart的Demo
看了视频后自己做了一下,当使用DropDownList改变WebPartManage的DisplayMode时,
会出错如下错误:
异常详细信息: System.ArgumentException: 此页当前禁用指定的显示模式。请确保为当前用户启用了个性化设置。
参数名: value
源错误:
行 26: break;
行 27: case "d":
行 28: WebPartManager1.DisplayMode = WebPartManager.DesignDisplayMode;
行 29: break;
行 30: case "b":
源文件: e:\DemoWebPart\Default.aspx.cs 行: 28
把下载来的Demo用Vs2005打开,修改了web.config的数据库连接后运行,也是报一样的错,在google搜了,
有一个人也遇到过这样的问题,不过发出后没有人能解决的了,想发到园子里看看,有没有朋友遇到并解决过.
运行时报错的代码如下(红色部分):
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
switch (DropDownList1.SelectedValue)
{
case "c":
WebPartManager1.DisplayMode = WebPartManager.CatalogDisplayMode;
break;
case "e":
WebPartManager1.DisplayMode = WebPartManager.EditDisplayMode;
break;
case "d":
WebPartManager1.DisplayMode = WebPartManager.DesignDisplayMode;
break;
case "b":
WebPartManager1.DisplayMode = WebPartManager.BrowseDisplayMode;
break;
default:
WebPartManager1.DisplayMode = WebPartManager.BrowseDisplayMode;
break;
}
}
附:在WebCast下载的Demo https://files.cnblogs.com/szflying/DemoWebPart.rar
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。