Best Approach To Adding Telerik Ajax Settings To SharePoint WebPart
This is the most effective way I have found to add the appropriate AJAX settings to a SharePoint WebPart. This differs from how you would add the settings within a normal ASP.NET context. There are a couple of assumptions that are placed within the code. Firstly, a Panel is going to be leveraged as the primary holder for a series of controls, and I am also going to call a recreate method for reliability of control recreation. This method should be called from the WebPart’s OnLoad event.
Using the below helper method:
- private void AddAjaxSettings()
- {
- RadAjaxManager current = RadAjaxManager.GetCurrent(Page);
- AjaxSetting ajaxSetting = new AjaxSetting([This Is Your Panel].ID);
- AjaxUpdatedControl newItem = new AjaxUpdatedControl
- {
- ControlID = [This Is Your Panel].ID,
- LoadingPanelID = LoadingPanel.ID
- };
- ajaxSetting.UpdatedControls.Add(newItem);
- current.AjaxSettings.Add(ajaxSetting);
- ajaxSetting = new AjaxSetting(current.ID);
- AjaxUpdatedControl ajaxUpdatedControl = new AjaxUpdatedControl
- {
- ControlID = [This Is Your Panel].ID,
- LoadingPanelID = LoadingPanel.ID
- };
- ajaxSetting.UpdatedControls.Add(ajaxUpdatedControl);
- current.AjaxSettings.Add(ajaxSetting);
- AjaxManager.AjaxRequest += (sender, args) => RecreateControlStructure(args.Argument);
- }
In the above replace [This Is Your Panel] with your Panel control reference since this will be at the field level. Then you are ready to read the properties in the RecreateControlStructure method using a method like:
- Dictionary<string, object> designerData = new JavaScriptSerializer().Deserialize<Dictionary<string, object>>(argument);
- object value;
- designerData.TryGetValue("A Property", out value);
Articles & Research
SharePoint Security
SharePoint Development
SharePoint Architecture
Claims Authentication
Forefront For SharePoint
AIS / Dynamics GP
Team Foundation Server
Pex And Moles
ISA/TMG/IAG/UAG
DPM
Cardspace
Research Methodology
Rural ICT Development
Numerical Analysis
Multi-Level Research
Knowledge Management
Personal/Off-Topic