小编abj*_*hat的帖子

使用LoadControl方法动态加载UserControl(类型,对象[])

我试图通过页面方法返回用户/服务器控件的html表示.当我调用带有虚拟路径到用户控件的重载时,它工作,但是当我尝试调用带有类型的重载时,它不起作用.示例代码如下.有什么建议?

[WebMethod]
public static string LoadAlternates(string productId, string pnlId)
{
    object[] parameters = new object[] { pnlId, productId };
    return ControlAsString(typeof(PopupControl), parameters);
}

private static string ControlAsString(Type controlType, object[] parameters)
{
    Page page = new Page();
    UserControl controlToLoad;
    /*
     *calling load control with the type results in the 
     *stringwriter returning an empty string
    */

    controlToLoad = page.LoadControl(controlType, parameters) as UserControl;
    /*
     *However, calling LoadControl with the following overload
     *gives the correct result, ie the string rep. of the control.
    */ …
Run Code Online (Sandbox Code Playgroud)

c# asp.net

20
推荐指数
2
解决办法
4万
查看次数

IIS 7.5和ASP .NET 2.0

IIS 7.5是否存在任何已知问题?当我尝试浏览/启动/查看网站上的任何页面时,我收到以下错误.

HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration
 data for the page is invalid.

Module  IIS Web Core
Notification    BeginRequest
Handler Not yet determined
Error Code  0x80070021
Config Error    This configuration section cannot be used at this path. 
 This happens when the section is locked at a parent level. Locking is either by
default (overrideModeDefault="Deny"), or set explicitly by a location tag with 
  overrideMode="Deny" or the legacy allowOverride="false". 

Config …
Run Code Online (Sandbox Code Playgroud)

asp.net asp.net-2.0 iis-7.5

16
推荐指数
2
解决办法
4万
查看次数

Datagrid在Silverlight 5中的位置是什么?

正如问题所问,是否有人知道Datagrid在Silverlight 5中使用了哪个命名空间和/或程序集?

它曾经在工具包中,但现在它已经消失了.Google和文档/程序集中的所有搜索都没有显示任何内容......令人抓狂!

任何帮助表示赞赏.

-提前致谢.

silverlight-5.0

3
推荐指数
1
解决办法
4558
查看次数

动态添加控件后状态信息损坏

在我的asp .net表单中,我通过AjaxPro库使用Ajax刷新控件.但是,执行此操作后...导致任何"正常"回发结果显示为黄色屏幕(消息后出现完整错误)

我在web.config中设置了以下页面属性,没有任何运气

<pages enableSessionState="true" enableViewState="false" enableEventValidation="false" enableViewStateMac="false">
Run Code Online (Sandbox Code Playgroud)

我也尝试过生成一个机器密钥,正如一些解决方案在线建议的那样.但这也无济于事.

有什么建议?

*******************ASP .NET黄色屏幕的内容************************************

Server Error in '/' Application.
The state information is invalid for this page and might be corrupted.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: The state information is invalid for this page and might be corrupted.

Source Error:

[No relevant source …
Run Code Online (Sandbox Code Playgroud)

.net c# asp.net

0
推荐指数
1
解决办法
4087
查看次数

标签 统计

asp.net ×3

c# ×2

.net ×1

asp.net-2.0 ×1

iis-7.5 ×1

silverlight-5.0 ×1