Modifying the SmartPart for Telerik Controls.

Jul 17, 2009 at 3:27 PM

Hi

I need to make modifications to the Smart Part so that I can eliminate the Initial Full post back when using Telerik controls. I have found a few resources detailing what needs to be done but being new to Share Point I am having difficulties and in Producing the installer and web part that is exactly the same as the download.

Does anyone have the project files for this or is able to advise the steps that need to be followed to package the source code into a Web Part.

Regards

Mike

Sep 3, 2009 at 1:00 PM

Hi

I found the solution to this problem on the Telerik website.

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(Page,
                  typeof(Page), "UpdatePanelFixup",
                  fixupScript, true);
            }
        }

You just need to call the above method before you call the EnsureChildControls method in Oninit in the AjaxSmartPart.cs.

Regards

Mike