Hi,
I am using AjxPro and trying to load my own WebUserControls but I get
this error: "Object reference not set to an instance of an object"

You help is appreciated
Ihab

Sample Code:
JavaScript
function loadDetailsControl()
{
    document.cursor='wait';
    var rslt = gvProject_ManageProjects.RenderDetailsView();
    populateDiv(rslt);
    document.cursor='default';
}
function loadUsersControl()
{
    document.cursor='wait';
    var rslt = gvProject_ManageProjects.RenderUsersView();
    populateDiv(rslt);
    document.cursor='default';
}

ASP:
public static string virPath = "";
    public static string absPath = "";
    public string RenderControl(string path, string regControls)
    {
        try
        {
            FormlessPage formlessPage = new FormlessPage();
            //ASP.gvproject_bodycontrols_formless_aspx formlessPage =
new ASP.gvproject_bodycontrols_formless_aspx();

            formlessPage.AppRelativeVirtualPath = virPath;
            //ASP.gvproject_bodycontrols_addprojectcontrol_ascx cntrl =
new ASP.gvproject_bodycontrols_addprojectcontrol_ascx();

            gvBaseUserControl cntrl =
(gvBaseUserControl)formlessPage.LoadControl(path);
            //cntrl.AppRelativeVirtualPath = path;
            formlessPage.Controls.Add(cntrl);
            //cntrl.ParameterControl =
"C1WebGrid_Projects,System.Object SelectedValue";
            cntrl.ID = "Ctrl0";
            cntrl.SessionParameterControl =
gv_ToolsLibrary.Global_Constants.PROJECT_ID;
            cntrl.RegisteredControls = regControls;
            //this.Panel1.Controls.Add(cntrl);
            cntrl.populate();
            StringWriter wrtr = new StringWriter();
            HttpContext.Current.Server.Execute(formlessPage, wrtr,
false);
            return wrtr.ToString().Replace("../images",
"../../images");
        }
        catch (Exception ex)
        {
            return ex.ToString();
        }
    }

    [AjaxPro.AjaxMethod()]
    public string RenderDetailsView(){
        return RenderControl(detailsURL, "");
    }
    [AjaxPro.AjaxMethod()]
    public string RenderSpecsView()
    {
        return RenderControl(specUrl, "");
    }
    [AjaxPro.AjaxMethod()]
    public string RenderUsersView()
    {
        return RenderControl(usersURL, "");
    }

Exception:
System.Web.HttpException: Error executing child request for handler
'FormlessPage'. ---> System.Web.HttpUnhandledException: Exception of
type 'System.Web.HttpUnhandledException' was thrown. --->
System.NullReferenceException: Object reference not set to an instance
of an object. at
Microsoft.Web.UI.PageRequestManager.RenderPageRequestManagerScript(HtmlTextWriter
writer) at Microsoft.Web.UI.PageRequestManager.Render(HtmlTextWriter
writer) at Microsoft.Web.UI.ScriptManager.Render(HtmlTextWriter writer)
at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer,
ControlAdapter adapter) at
System.Web.UI.Control.RenderControl(HtmlTextWriter writer,
ControlAdapter adapter) at
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer,
ICollection children) at
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) at
System.Web.UI.Control.Render(HtmlTextWriter writer) at
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer,
ControlAdapter adapter) at
System.Web.UI.Control.RenderControl(HtmlTextWriter writer,
ControlAdapter adapter) at
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer,
ICollection children) at
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) at
System.Web.UI.Control.Render(HtmlTextWriter writer) at
System.Web.UI.Page.Render(HtmlTextWriter writer) at
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer,
ControlAdapter adapter) at
System.Web.UI.Control.RenderControl(HtmlTextWriter writer,
ControlAdapter adapter) at
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
--- End of inner exception stack trace --- at
System.Web.UI.Page.HandleError(Exception e) at
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at
System.Web.UI.Page.ProcessRequest(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at
System.Web.UI.Page.ProcessRequest() at
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at
System.Web.UI.Page.ProcessRequest(HttpContext context) at
System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler,
TextWriter writer, Boolean preserveForm, Boolean setPreviousPage,
VirtualPath path, VirtualPath filePath, String physPath, Exception
error, String queryStringOverride) --- End of inner exception stack
trace --- at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler
handler, TextWriter writer, Boolean preserveForm, Boolean
setPreviousPage, VirtualPath path, VirtualPath filePath, String
physPath, Exception error, String queryStringOverride) at
System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter
writer, Boolean preserveForm, Boolean setPreviousPage) at
System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter
writer, Boolean preserveForm) at
gvProject_ManageProjects.RenderControl(String path, String regControls)
in
d:\gvTools\gvProject\gvProject\BodyControls\WebUserControl.ascx.cs:line
62


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Ajax.NET Professional" group.

To post to this group, send email to ajaxpro@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]

For more options, visit this group at http://groups.google.com/group/ajaxpro

The latest downloads of Ajax.NET Professional can be found at 
http://www.ajaxpro.info/

Don't forget to read my blog at http://weblogs.asp.net/mschwarz/

The open source project is now located at 
http://www.codeplex.com/Wiki/View.aspx?ProjectName=AjaxPro
-~----------~----~----~----~------~----~------~--~---

Reply via email to