This is a migrated thread and some comments may be shown as answers.

Deploying RadControls into MOSS 2007 WebParts

4 Answers 160 Views
Sharepoint Integration
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 28 May 2008, 01:55 PM
Hi All,
I'm working on a project where deployment of RadControls into SharePoint 2007 WebParts is essential.  I've followed the steps on the documentation site (http://www.telerik.com/help/aspnet-ajax/moss-deploying-radcontrols.html), but I am getting the following permissions error when I load my user control webpart into a web part zone: 

CreateChildControls_Exception: "Access to the path 'C:\Inetpub\wwwroot\wss\VirtualDirectories\80\UserControls\myTreeControl.ascx' is denied."

I'm not sure if additional configuration apart from what is included in the documentation is neccessary.  Please help if you can.

Thanks,
John P.

4 Answers, 1 is accepted

Sort by
0
John
Top achievements
Rank 1
answered on 28 May 2008, 05:55 PM
I've fixed the previous problem, but now when the web part loads, there is no ajax functionality.  Every event fires a full page refresh.  Any ideas why this is happening?
0
John
Top achievements
Rank 1
answered on 28 May 2008, 09:10 PM

Here is my code.  When I run the web part on SharePoint everything works except the ajax post back functionality and I get the following error message displaying below the control: 

CreateChildControls_Exception: The control with ID 'UpdatePanel1' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it.

This would lead me to believe that for some reason my ScriptManager is not doing its job.  Any suggestions?


using

System;

using

System.Data;

using

System.Configuration;

using

System.Web;

using

System.Web.Security;

using

System.Web.UI;

using

Microsoft.SharePoint.WebPartPages;

using

System.Web.UI.WebControls;

using

System.Web.UI.HtmlControls;

using

System.IO;

 

namespace

jpTelerikDeployment

{

//Set the inheritance of the class to WebPart

public class MyInformation : WebPart

{

//The control object that we will be loading our user control into

private Control _control;

private string _exceptions = String.Empty;

//These two properties determine the location from which to load the associated Web Control ASCX file.

protected string UserControlPath = @"~/UserControls/";

protected string UserControlFileName = "jpTelerikDeploymentControl.ascx";

protected override void OnInit(EventArgs e)

{

//Test to see if there is currently a script manager on the site

if (ScriptManager.GetCurrent(this.Page) == null)

{

//If there is not, add one

ScriptManager scriptHandler = new ScriptManager();

scriptHandler.ID =

"scriptHandler";

this.Controls.Add(scriptHandler);

}

base.OnInit(e);

}

protected override void CreateChildControls()

{

//creates the base to build child controls

base.CreateChildControls();

//Fix for the UpdatePanel postback behaviour.

EnsurePanelFix();

try

{

//Load the control path string

_control =

this.Page.LoadControl(UserControlPath + UserControlFileName);

// add it to controls collection to wire up events

this.Controls.Add(_control);

}

catch (Exception CreateChildControls_Exception)

{

_exceptions +=

"CreateChildControls_Exception: " + CreateChildControls_Exception.Message;

}

}

protected override void RenderContents(HtmlTextWriter writer)

{

try

{

base.RenderContents(writer);

}

catch (Exception RenderContents_Exception)

{

_exceptions +=

"RenderContents_Exception: " + RenderContents_Exception.Message;

}

finally

{

if (_exceptions.Length > 0)

{

writer.WriteLine(_exceptions);

}

}

}

private void EnsurePanelFix()

{

if (this.Page.Form != null)

{

String fixupScript = @"

_spBodyOnLoadFunctionNames.push(""_initFormActionAjax"");

function _initFormActionAjax()

{

if (_spEscapedFormAction == document.forms[0].action)

{

document.forms[0]._initialAction =

document.forms[0].action;

}

}

var RestoreToOriginalFormActionCore =

RestoreToOriginalFormAction;

RestoreToOriginalFormAction = function()

{

if (_spOriginalFormAction != null)

{

RestoreToOriginalFormActionCore();

document.forms[0]._initialAction =

document.forms[0].action;

}

}"

;

ScriptManager.RegisterStartupScript(this, typeof(MyInformation), "UpdatePanelFixup",

fixupScript,

true);

}

}

}

}

0
Rosen
Telerik team
answered on 30 May 2008, 07:55 AM
Hello John ,

Can you please try to add the ScriptManager to the page's Form controls collection instead of the webpart's controls collection. Similar to this:

this.Page.Form.Controls.Add(scriptHandler);  

If you continue to experience difficulties please sent us (attached to a formal ticket) a working project in which this behavior can be observed. Thus we will do our best to provide more to-the-point answer/solution.

Best regards,
Rosen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
John
Top achievements
Rank 1
answered on 30 May 2008, 01:37 PM
Rosen,
Thanks for the help.  That actually fixed the problem.  I was also having issues adding two ajax enabled web parts to the same page, but that has been fixed as well.  Thanks again.

John P
Tags
Sharepoint Integration
Asked by
John
Top achievements
Rank 1
Answers by
John
Top achievements
Rank 1
John
Top achievements
Rank 1
Rosen
Telerik team
Share this question
or