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

Using ASP.NET AJAX RadControls in SharePoint 2010

25 Answers 144 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Makoto
Top achievements
Rank 1
Makoto asked on 09 Mar 2012, 04:27 AM
Hello,

I noticed that you have a product line for SharePoint 2010. However components included are RadEditors and web parts.

If I wanted to use a bunch of RadControls on SharePoint pages on a web part (rather than using a dedicated web part provided by Telerik), the steps on installation the same as SharePoint 2007? I see how to do that documented for SharePoint 2007, but all of the documentation for SharePoint 2010 are about RadEditor and webparts.

Thanks in advance,
Makoto

25 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 13 Mar 2012, 03:00 PM
Hi Makoto,

The Create an AJAX-enabled SharePoint WebPart that uses RadControls article is also applicable for SharePoint 2010. Note that it is not recommended to implement Sharepoint solutions in Sandbox environment because of problem with the integration of controls implementing IScriptControl interface in the sandbox model.

Best regards,
Rumen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Kishore
Top achievements
Rank 1
answered on 30 Mar 2012, 05:13 PM
I have followed the instructions mentioned at http://www.telerik.com/help/aspnet-ajax/moss-create-ajax-enabled-sharepoint-webpart-radcontrols.html   in SharePoint 2010, however when I am trying to add Visual Webpart, its not getting added, the aspx page is crashing.

Here is the code snippet that i have added as per the instructions in the above url.
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Telerik.Web.UI;
 
namespace Rollup.AjaxWebpart
{
    public partial class AjaxWebpartUserControl : UserControl
    {
        protected string output;
 
        protected void Page_Load(object sender, EventArgs e)
        {
            base.OnLoad(e);
             
            Panel panel = new Panel();
            panel.ID = "Panel1";
            this.Controls.Add(panel);
             
            RadTreeView treeView = new RadTreeView();
            treeView.ID = "RadTreeView1";
            treeView.Nodes.Add(new RadTreeNode("What's the time?"));
            treeView.NodeClick += new RadTreeViewEventHandler(treeView_NodeClick);
            panel.Controls.Add(treeView);
 
            label = new Label();
            label.Text = "This is a label";
            panel.Controls.Add(label);
             
            RadAjaxManager ajaxManager = RadAjaxManager.GetCurrent(this.Page);
            if (ajaxManager == null)
            {
                ajaxManager = new RadAjaxManager();
                ajaxManager.ID = "RadAjaxManager1";
                Controls.Add(ajaxManager);
                this.Page.Items.Add(typeof(RadAjaxManager), ajaxManager);
            }
            ajaxManager.AjaxSettings.AddAjaxSetting(treeView, panel);
        }
 
        void treeView_NodeClick(object sender, RadTreeNodeEventArgs e)
        {
            label.Text = DateTime.Now.ToLongTimeString();
        }
 
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            Page.ClientScript.RegisterStartupScript(typeof(AjaxWebpart), this.ID, "_spOriginalFormAction = document.forms[0].action;_spSuppressFormOnSubmitWrapper=true;", true);
            if (this.Page.Form != null)
            {
                string formOnSubmitAtt = this.Page.Form.Attributes["onsubmit"];
                if (!string.IsNullOrEmpty(formOnSubmitAtt) && formOnSubmitAtt == "return _spFormOnSubmitWrapper();")
                {
                    this.Page.Form.Attributes["onsubmit"] = "_spFormOnSubmitWrapper();";
                }
            }
 
            ScriptManager scriptManager = ScriptManager.GetCurrent(this.Page);
            if (scriptManager == null)
            {
                scriptManager = new RadScriptManager();
                this.Page.Form.Controls.AddAt(0, scriptManager);
            }
        }
    }
}

I haven't done any other modifications in any place (master page etc...), are those required??. Can any one please let me know if anything else is required to work this?

Thanks in advance.

Regards,
Kishore
0
Cat Cheshire
Top achievements
Rank 1
answered on 06 Apr 2012, 06:48 PM
The instruction in the article are related to SharePoint 2007.
Since you use SharePoint 2010 - you can simply add the treeview in a VisualWebPart.
0
Dennis Schroder
Top achievements
Rank 1
answered on 17 Apr 2012, 01:51 PM
What is the solution if you don't want to use a visual web part?  I have several non visual web parts that I am porting from wss3 and I still can't get ajax to work properly.  The web parts work fine if I don't have ajax enabled on the controls.  If I have a radgrid with a GridDropDownColumn and a GridDateTimeColumn with ajax enabled for the grid, the GridDropDownColumn is read only and will not drop down when clicked.  The GridDateTimeColumn column will not drop down and display the calendar.  If I disable ajax for the grid, the grid columns work properly but postbacks occur.

Does anyone know the exact steps to go from a clean install of SharePoint 2010 to an install of SharePoint 2010 that supports ajax enabled rad controls from a non visual web part?
0
Tsvetoslav
Telerik team
answered on 18 Apr 2012, 12:30 PM
Hello Makoto,

In order to do so, set up the RadAjaxManager control in your web part code as follows:

private RadAjaxManager _ajaxManager;
private RadWindowManager _windowManager;
protected override void OnInit(EventArgs e)
{
    base.OnInit(e);
    SetUpAjaxManagerOnPage();
    EnsureChildControls();
}
protected void SetUpAjaxManagerOnPage()
{
    RadAjaxManager currentAjaxManager = RadAjaxManager.GetCurrent(Page);
    if (currentAjaxManager == null)
    {
        Page.Form.Controls.AddAt(0, AjaxManager);
        Page.Items.Add(typeof(RadAjaxManager), AjaxManager);
    }
}
protected virtual RadAjaxManager AjaxManager
{
    get
    {
        if (_ajaxManager == null)
        {
            _ajaxManager = RadAjaxManager.GetCurrent(Page);
            if (_ajaxManager == null)
            {
                _ajaxManager = new RadAjaxManager() { ID = "RadAjaxManager1" };
            }
        }
        return _ajaxManager;
    }
}

Then in the OnLoad event of the web part add your ajax settings as shown below:
protected override void OnLoad(EventArgs e)
{
    base.OnLoad(e);
    AddAjaxSettings();
    
}
private void AddAjaxSettings()
{
    RadAjaxManager _manager = RadAjaxManager.GetCurrent(Page);
    AjaxSetting setting = new AjaxSetting(MyRadGrid.ID);
    setting.UpdatedControls.Add(new AjaxUpdatedControl() { ControlID = MyRadGrid.ID, LoadingPanelID = MyLoadingPanel.ID});
  
    _manager.AjaxSettings.Add(setting);
}

Hope it helps


Greetings,
Tsvetoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Ronak
Top achievements
Rank 1
answered on 18 Jul 2012, 02:41 PM
Hi Tsvetoslav,
Where should i put this code in meaning in UserControl code behind file or in Webpart code behind file. ?

Thanks
ROnak
0
Tsvetoslav
Telerik team
answered on 23 Jul 2012, 11:03 AM
Hi Ronak,

The code should go into the web part code-behind. Attached is a sample ajaxified web part.

All the best,
Tsvetoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Ronak
Top achievements
Rank 1
answered on 23 Jul 2012, 05:39 PM
Thanks for your quick reply code works but does not ajxify Tabstrip and multipageView control.i am trying to create Example mention on your side Load on demand.i dont even see loading Panel.

Please advise

Thanks
ROnak
0
Tsvetoslav
Telerik team
answered on 24 Jul 2012, 11:24 AM
Hello Ronak,

Could you share your code? You can either open up a formal support ticket or use the CODE FORMATTER tool of the ticket eidtor to paste the code.


All the best,
Tsvetoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Ronak
Top achievements
Rank 1
answered on 24 Jul 2012, 05:32 PM
Thanks Tsvetoslav  for being with me on this issue.i am trying to achieve explain in this link here http://demos.telerik.com/aspnet-ajax/tabstrip/examples/applicationscenarios/loadondemand/defaultcs.aspx
I have Created Visual webpart in Visual studio 2010 which as you know UserControl wrap in Webpart class.
Please find code like HTML and also C#

HTML Markup for .ascx
<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI, Version=2012.2.607.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" %>
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WorkspacesTabs.ascx.cs" Inherits="CGIRB.Connexus.SharePoint.Webparts.WorkspacesTabs" %>
<script type="text/javascript">
    function onTabSelecting(sender, args) {
 
        if (args.get_tab().get_pageViewID()) {
            args.get_tab().set_postBack(false);
        }
    }
</script>
<Telerik:RadAjaxLoadingPanel ID="radajaxloadingPanel" runat="server" Skin="Default" />
<Telerik:RadMultiPage ID="radWorkspaceMultiPage"
                      runat="server"
                      SelectedIndex="0"
                      OnPageViewCreated="radWorkspaceMultiPage_PageViewCreated"      
                      >
</Telerik:RadMultiPage>
<Telerik:RadTabStrip ID="radWorkspaceTab"
                     runat="server"
                     Orientation="HorizontalTop"
                     OnTabClick="radWorkspaceTab_TabClick"
                     OnClientTabSelecting="onTabSelecting"
                     SelectedIndex="0"
                     MultiPageID="radWorkspaceMultiPage"
                     >
</Telerik:RadTabStrip>

Code behind file for .ascx.cs
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Telerik.Web.UI;
 
namespace CGIRB.Connexus.SharePoint.Webparts
{
    public partial class WorkspacesTabs : UserControl
    {
        protected void Page_Load(object sender, EventArgs e) {
 
            if (!this.IsPostBack) {
                AddTab("Drafts");
                AddPageView(radWorkspaceTab.FindTabByText("Drafts"));
                AddTab("Submitted");
            }
            
        }
        
        
        protected void radWorkspaceMultiPage_PageViewCreated(object sender, RadMultiPageEventArgs e)
        {
            string _controlPath = string.Empty;
            if (e.PageView.ID == "Drafts")
            {
                _controlPath = @"~/_CONTROLTEMPLATES/Connexus/DraftsWorkspaces.ascx";
            }
            else
            {
                _controlPath = @"~/_CONTROLTEMPLATES/Connexus/SubmittedWorkspaces.ascx";
            }
            Control control = Page.LoadControl(_controlPath);
            control.ID = e.PageView.ID + "_userControl";
            e.PageView.Controls.Add(control);
        }
        protected void radWorkspaceTab_TabClick(object sender, RadTabStripEventArgs e)
        {
            AddPageView(e.Tab);
            e.Tab.PageView.Selected = true;
        }
        private void AddTab(string tabName)
        {
            RadTab tab = new RadTab();
            tab.Text = tabName;
            radWorkspaceTab.Tabs.Add(tab);
        }
        private void AddPageView(RadTab tab)
        {
            RadPageView pageView = new RadPageView();
            pageView.ID = tab.Text;
            radWorkspaceMultiPage.PageViews.Add(pageView);
            //pageView.CssClass = "pageView";
            tab.PageViewID = pageView.ID;
        }
        private void AddAjaxSettings()
        {
            RadAjaxManager _manager = RadAjaxManager.GetCurrent(Page);
            if (_manager != null) {
                _manager.AjaxSettings.AddAjaxSetting(radWorkspaceTab, radWorkspaceTab);
                _manager.AjaxSettings.AddAjaxSetting(radWorkspaceTab,radWorkspaceMultiPage,radajaxloadingPanel);
                _manager.AjaxSettings.AddAjaxSetting(radWorkspaceMultiPage, radWorkspaceMultiPage,radajaxloadingPanel);
            }
             
        }
    }
}

Code behind file for Class Derived for Webpart
using System;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using Telerik.Web.UI;
using CGIRB.Connexus.SharePoint.Common;
using SITROF.SP.Framework.Common;
 
namespace CGIRB.Connexus.SharePoint.Webparts
{
    [ToolboxItemAttribute(false)]
    public class Workspaces : WebPartBase
    {
        // Visual Studio might automatically update this path when you change the Visual Web Part project item.
        private const string _ascxPath = @"~/_CONTROLTEMPLATES/Connexus/WorkspacesTabs.ascx";
        private bool _error = false;
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            base.SetUpAjaxManagerOnPage();
            EnsureChildControls();
        }
        protected override void CreateChildControls()
        {
            if (!_error)
            {
 
                try
                {
                    //base.CreateChildControls();
                    Control control = Page.LoadControl(_ascxPath);
                    RadAjaxLoadingPanel loadingPanel = control.FindControl("radajaxloadingPanel") as RadAjaxLoadingPanel;
                    RadTabStrip radtabStrip = control.FindControl("radWorkspaceTab") as RadTabStrip;
                    RadMultiPage radmultiPage = control.FindControl("radWorkspaceMultiPage") as RadMultiPage;
                    if (radtabStrip != null && radmultiPage != null)
                    {
                        AjaxSetting TabajaxSetting = new AjaxSetting();
                        TabajaxSetting.AjaxControlID = radtabStrip.ID;
                        TabajaxSetting.UpdatedControls.Add(new AjaxUpdatedControl(radmultiPage.ID, loadingPanel.ID));
                        TabajaxSetting.UpdatedControls.Add(new AjaxUpdatedControl());
                        AjaxSetting multipageAjaxSetting = new AjaxSetting();
                        multipageAjaxSetting.AjaxControlID = radmultiPage.ID;
                        multipageAjaxSetting.UpdatedControls.Add(new AjaxUpdatedControl(radmultiPage.ID, loadingPanel.ID));
                    }
                    Controls.Add(control);
                }
                catch (Exception ex)
                {
                    HandleException(ex);
                    string logCategory = Logger.BuildCategory(CONNEXUSConstants.CommonApplicationSettings.AREA, CONNEXUSConstants.SystemDiagnosticCategories.WEBPARTS);
                    Logger.LogUnexpected(ex.Message, logCategory);
                }
            }
        }
 
 
        private void HandleException(Exception ex)
        {
            this._error = true;
            this.Controls.Clear();
            this.Controls.Add(new LiteralControl(ex.Message));
        }
 
    }
}

Code Behind file for Base class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls.WebParts;
using Telerik.Web.UI;
namespace CGIRB.Connexus.SharePoint.Common
{
    public class WebPartBase : WebPart {
        private RadAjaxManager _ajaxManager;
        protected virtual RadAjaxManager AjaxManager
        {
            get
            {
                if (_ajaxManager == null)
                {
                    _ajaxManager = RadAjaxManager.GetCurrent(Page);
 
                    if (_ajaxManager == null)
                    {
                        _ajaxManager = new RadAjaxManager() { ID = "RadAjaxManager1" };
                    }
                }
 
                return _ajaxManager;
            }
        }
        protected void SetUpAjaxManagerOnPage()
        {
            RadAjaxManager currentAjaxManager = RadAjaxManager.GetCurrent(Page);
 
            if (currentAjaxManager == null)
            {
                Page.Form.Controls.AddAt(0, AjaxManager);
                Page.Items.Add(typeof(RadAjaxManager), AjaxManager);
            }
        }
    }
}

Please do let me know if you need further information.

Thanks
ROnak
0
Tsvetoslav
Telerik team
answered on 26 Jul 2012, 10:43 AM
Hello Ronak,

I am attaching a small sample with a tab strip and a grid. Please, take a look at it and do note that in this case you need to ajaxify just the tab strip and the multipage.

Greetings,
Tsvetoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Ronak
Top achievements
Rank 1
answered on 26 Jul 2012, 04:56 PM
Thanks Tsvetoslav it worked. you rock man.i also have problem getting tab at bottom even though i set orientation Top.
please advise

Ronak
0
Tsvetoslav
Telerik team
answered on 30 Jul 2012, 01:06 PM
Hi Ronak,

Could you send the complete code of your updated web part implementation and explain where you set the orientation of the tab and under what circumstances it goes wrong.

All the best,
Tsvetoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Ronak
Top achievements
Rank 1
answered on 30 Jul 2012, 02:06 PM
Thanks  Tsvetoslav  for your reply its same  code as i sent you before please take look at HTML markup of .ascx of radTabStrip.
it always show at bottom.

Thanks 
Ronak
0
Plamen
Telerik team
answered on 02 Aug 2012, 02:28 PM
Hi Ronak,

You can set the Orientation="HorizontalBottom" property of RadTabStrip and add it bellow the MultiPage as in the code below:
    </telerik:RadPageView>
</telerik:RadMultiPage>
<telerik:RadTabStrip ID="RadTabStrip1" runat="server"  MultiPageID="RadMultiPage1" Orientation="HorizontalBottom">
    <Tabs>
        <telerik:RadTab PageViewID="RadPageView1" Selected="true" Text="Tab containing grid" runat="server" >
        </telerik:RadTab>
    </Tabs>
</telerik:RadTabStrip>

Hope this will help you.

Kind regards,
Plamen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Ronak
Top achievements
Rank 1
answered on 03 Aug 2012, 12:28 PM
Thanks Plamen for your reply.

Ronak
0
Ronak
Top achievements
Rank 1
answered on 06 Aug 2012, 06:39 PM
HI i am using HorizontalTop orientation but still see tabs at bottom.
here is code
<Telerik:RadMultiPage ID="radWorkspaceMultiPage"
                      runat="server"
                      SelectedIndex="0"
                      OnPageViewCreated="radWorkspaceMultiPage_PageViewCreated"      
                      >
</Telerik:RadMultiPage>
<Telerik:RadTabStrip ID="radWorkspaceTab"
                     runat="server"
                     OnTabClick="radWorkspaceTab_TabClick"
                     OnClientTabSelecting="onTabSelecting"
                     SelectedIndex="0"
                     MultiPageID="radWorkspaceMultiPage"
                     Orientation="HorizontalTop"
                     >
</Telerik:RadTabStrip>

Please advise 

ROnak
0
Plamen
Telerik team
answered on 09 Aug 2012, 10:29 AM
Hello ROnak,

 
If you want to have RadTabStrip on top of the RadMultiPage you have to change their places in the mark up:

<Telerik:RadTabStrip ID="radWorkspaceTab"
                     runat="server"
                     OnTabClick="radWorkspaceTab_TabClick"
                     OnClientTabSelecting="onTabSelecting"
                     SelectedIndex="0"
                     MultiPageID="radWorkspaceMultiPage"
                     Orientation="HorizontalTop"
                     >
</Telerik:RadTabStrip>
<Telerik:RadMultiPage ID="radWorkspaceMultiPage"
                      runat="server"
                      SelectedIndex="0"
                      OnPageViewCreated="radWorkspaceMultiPage_PageViewCreated"     
                      >
</Telerik:RadMultiPage>

You can also refer to this on-line demo where the orientation functionality have been described with the help of two RadTabStrips.

Hope this will be helpful.
Kind regards,
Plamen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Ronak
Top achievements
Rank 1
answered on 10 Aug 2012, 12:29 PM
Thanks It works
0
Ronak
Top achievements
Rank 1
answered on 16 Oct 2012, 01:27 PM
Thanks Tsvetoslav as with your help i am able to implement ajax in sharepoint 2010 webpart but now i am struggling to get it work in case of .ascx control and then adding this control to sharepoint page.
In my case i have radgrid in .ascx conrol now i want to ajixy with export functionality.

Please advise 

Thanks 
ROnak
0
Tsvetoslav
Telerik team
answered on 17 Oct 2012, 06:22 AM
Hi Ronak,

There should be no problem with exporting the grid if you have already ajaxified it correctly. Just make sure that you have the following lines of code in the OnInit event of the web part (not the ascx):
Page.ClientScript.RegisterStartupScript(typeof(Web_Part1), this.ID, "_spOriginalFormAction = document.forms[0].action;_spSuppressFormOnSubmitWrapper=true;", true);
if (this.Page.Form != null)
{
    string formOnSubmitAtt = this.Page.Form.Attributes["onsubmit"];
    if (!string.IsNullOrEmpty(formOnSubmitAtt) && formOnSubmitAtt == "return _spFormOnSubmitWrapper();")
    {
        this.Page.Form.Attributes["onsubmit"] = "_spFormOnSubmitWrapper();";
    }
}




Hope it helps.

Regards,
Tsvetoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Arun Kumar
Top achievements
Rank 2
answered on 07 Sep 2013, 05:18 AM
I am developing sharepoint 2010 visual web part using Visual Studio 2012. I am following the sample project attached in this thread to ajaxfy the web part. But I am not able to work it correctly.

Problem: I have couple of raddropdownlist and it loads data based on selected item. [Scenario 1: If I select item from raddropdownlist it loads data for radlistbox. If I select item it does not show radlistbox control. If I remove ajaxsetting it load data show the listbox fine. ] Same thing happens on other cascading dropdownlists.


Could someone please help me on this ? It is urgent.

  [ToolboxItemAttribute(false)]
    public partial class NewLicense : WebPart
    {
 
        #region RadAjaxManager Setting
 
        private RadAjaxManager _ajaxManager;
 
        protected virtual RadAjaxManager AjaxManager
        {
            get
            {
                if (_ajaxManager == null)
                {
                    _ajaxManager = RadAjaxManager.GetCurrent(Page);
 
                    if (_ajaxManager == null)
                    {
                        _ajaxManager = new RadAjaxManager() { ID = "RadAjaxManager1" };
                    }
                }
 
                return _ajaxManager;
            }
        }
 
        protected void SetupAjaxManagerOnPage()
        {
            RadAjaxManager currentAjaxManager = RadAjaxManager.GetCurrent(Page);
 
            if (currentAjaxManager == null)
            {
                Page.Form.Controls.AddAt(0, AjaxManager);
                Page.Items.Add(typeof(RadAjaxManager), AjaxManager);
            }
        }
 
        private void AddAjaxSettings()
        {
 
            RadAjaxManager _manager = RadAjaxManager.GetCurrent(Page);
            AjaxSetting setting;
 
            setting = new AjaxSetting(ddlActivityGroup.ID);
            setting.UpdatedControls.Add(new AjaxUpdatedControl() { ControlID = lstActivitiesSource.ID, LoadingPanelID = ralp.ID });
            setting.UpdatedControls.Add(new AjaxUpdatedControl() { ControlID = lstActivities.ID, LoadingPanelID = ralp.ID });
            _manager.AjaxSettings.Add(setting);
 
            setting = new AjaxSetting(lstActivitiesSource.ID);
            setting.UpdatedControls.Add(new AjaxUpdatedControl() { ControlID = lstActivitiesSource.ID, LoadingPanelID = ralp.ID });
            setting.UpdatedControls.Add(new AjaxUpdatedControl() { ControlID = lstActivities.ID, LoadingPanelID = ralp.ID });
            _manager.AjaxSettings.Add(setting);
 
            setting = new AjaxSetting(ddlCity.ID);
            setting.UpdatedControls.Add(new AjaxUpdatedControl() { ControlID = ddlSector.ID, LoadingPanelID = ralp.ID });
            setting.UpdatedControls.Add(new AjaxUpdatedControl() { ControlID = ddlDistrict.ID, LoadingPanelID = ralp.ID });
            _manager.AjaxSettings.Add(setting);
 
            setting = new AjaxSetting(ddlSector.ID);
            setting.UpdatedControls.Add(new AjaxUpdatedControl() { ControlID = ddlDistrict.ID, LoadingPanelID = ralp.ID });
            _manager.AjaxSettings.Add(setting);
 
            setting = new AjaxSetting(ddlDistrict.ID);
            setting.UpdatedControls.Add(new AjaxUpdatedControl() { ControlID = imgSector.ID, LoadingPanelID = ralp.ID });
            setting.UpdatedControls.Add(new AjaxUpdatedControl() { ControlID = imgDistrict.ID, LoadingPanelID = ralp.ID });
            setting.UpdatedControls.Add(new AjaxUpdatedControl() { ControlID = imgParcel.ID, LoadingPanelID = ralp.ID });
            setting.UpdatedControls.Add(new AjaxUpdatedControl() { ControlID = txtParcelId.ID, LoadingPanelID = ralp.ID });
            setting.UpdatedControls.Add(new AjaxUpdatedControl() { ControlID = txtOldParcelId.ID, LoadingPanelID = ralp.ID });
            _manager.AjaxSettings.Add(setting);
 
            setting = new AjaxSetting(btnSearch.ID);
            setting.UpdatedControls.Add(new AjaxUpdatedControl() { ControlID = dgvSearchMemberResult.ID, LoadingPanelID = ralp.ID });
            _manager.AjaxSettings.Add(setting);
 
            setting = new AjaxSetting(btnReset.ID);
            setting.UpdatedControls.Add(new AjaxUpdatedControl() { ControlID = dgvSearchMemberResult.ID, LoadingPanelID = ralp.ID });
            setting.UpdatedControls.Add(new AjaxUpdatedControl() { ControlID = txtSearchEmiratesId.ID, LoadingPanelID = ralp.ID });
            setting.UpdatedControls.Add(new AjaxUpdatedControl() { ControlID = txtSearchPassportNumber.ID, LoadingPanelID = ralp.ID });
            setting.UpdatedControls.Add(new AjaxUpdatedControl() { ControlID = txtSearchMobileNumber.ID, LoadingPanelID = ralp.ID });
            setting.UpdatedControls.Add(new AjaxUpdatedControl() { ControlID = dtpSearchDateOfBirth.ID, LoadingPanelID = ralp.ID });
            setting.UpdatedControls.Add(new AjaxUpdatedControl() { ControlID = ddlSearchNationality.ID, LoadingPanelID = ralp.ID });
            _manager.AjaxSettings.Add(setting);
 
            setting = new AjaxSetting(txtCustomerNumber.ID);
            setting.UpdatedControls.Add(new AjaxUpdatedControl() { ControlID = ddlBNReservedList.ID, LoadingPanelID = ralp.ID });
            _manager.AjaxSettings.Add(setting);
 
            setting = new AjaxSetting(btnUpload.ID);
            setting.UpdatedControls.Add(new AjaxUpdatedControl() { ControlID = dgvAttachments.ID, LoadingPanelID = ralp.ID });
            setting.UpdatedControls.Add(new AjaxUpdatedControl() { ControlID = rauAttachments.ID, LoadingPanelID = ralp.ID });
            setting.UpdatedControls.Add(new AjaxUpdatedControl() { ControlID = btnUpload.ID, LoadingPanelID = ralp.ID });
            _manager.AjaxSettings.Add(setting);
 
            setting = new AjaxSetting(btnSubmit.ID);
            setting.UpdatedControls.Add(new AjaxUpdatedControl() { ControlID = pnl.ID, LoadingPanelID = ralp.ID });
            _manager.AjaxSettings.Add(setting);
 
            setting = new AjaxSetting(btnCancel.ID);
            setting.UpdatedControls.Add(new AjaxUpdatedControl() { ControlID = pnl.ID, LoadingPanelID = ralp.ID });
            _manager.AjaxSettings.Add(setting);
 
        }
 
        #endregion
 
 
        /// <summary>
        /// Page Init Event
        /// </summary>
        /// <param name="e"></param>
        protected override void OnInit(EventArgs e)
        {
 
            base.OnInit(e);
 
            SetupAjaxManagerOnPage();
            EnsureChildControls();
 
            InitializeControl();
 
        }
 
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            AddAjaxSettings();
        }
 
        /// <summary>
        /// Constructor
        /// </summary>
        public NewLicense()
        {
 
        }
 
}

Here is markup:

<table>
    <tr>
        <td colspan="2">
            <asp:Label runat="server" ID="lblActivityGroup" Text="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,ActivityGroup%>"
                AssociatedControlID="ddlActivityGroup" />
 
        </td>
    </tr>
    <tr>
        <td colspan="2">
            <telerik:RadDropDownList ID="ddlActivityGroup" runat="server" Width="100%" AutoPostBack="true" Skin="Silk" DropDownHeight="200px"
                DefaultMessage="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,DefaultSelect%>"
                OnInit="ddlActivityGroup_Init" OnSelectedIndexChanged="ddlActivityGroup_SelectedIndexChanged" />
        </td>
    </tr>
    <tr>
        <td class="tdList">
            <telerik:RadListBox ID="lstActivitiesSource" runat="server" Width="100%" Height="300px" Skin="Silk" AllowTransfer="true"
                AllowTransferDuplicates="false" AllowTransferOnDoubleClick="true" TransferToID="lstActivities" TransferMode="Move"
                AutoPostBackOnTransfer="true" OnItemDataBound="lstActivitiesSource_ItemDataBound" OnTransferred="lstActivitiesSource_Transferred">
 
                <ButtonSettings ShowDelete="false" ShowTransferAll="false" ShowReorder="false" />
 
                <ItemTemplate>
                    <asp:Label ID="lblLASDescription" runat="server" Text='<%# DataBinder.Eval(Container, "Attributes[\"Description\"]")%>'></asp:Label>
                </ItemTemplate>
 
            </telerik:RadListBox>
        </td>
        <td class="tdList">
            <telerik:RadListBox ID="lstActivities" runat="server" Width="100%" Height="300px" AllowDelete="true" Skin="Silk">
                <ItemTemplate>
                    <asp:Label ID="lblLADescription" runat="server" Text='<%# DataBinder.Eval(Container, "Attributes[\"Description\"]")%>'></asp:Label>
                </ItemTemplate>
            </telerik:RadListBox>
            <asp:CustomValidator runat="server" ID="ActivitiesValidator" ValidateEmptyText="true"
                ControlToValidate="lstActivities"
                ClientValidationFunction="validateActivities"
                OnServerValidate="ActivitiesValidator_ServerValidate"
                ValidationGroup="LicenseInfoValidation"
                ErrorMessage="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,ActivitiesRequired%>" />
        </td>
    </tr>
</table>

protected void ddlActivityGroup_SelectedIndexChanged(object sender, DropDownListEventArgs e)
       {
           if (this.ddlActivityGroup.SelectedIndex >= 0)
           {
               masterData = new MasterDataBPO();
 
               lstActivitiesSource.DataSource = masterData.GetISICClassificationList(Convert.ToInt32(e.Value), 10);
               lstActivitiesSource.DataBind();
           }
       }
 
 protected void lstActivitiesSource_ItemDataBound(object sender, RadListBoxItemEventArgs e)
       {
           e.Item.Text = ((ISICClassification)e.Item.DataItem).Description;
           e.Item.Value = ((ISICClassification)e.Item.DataItem).RecordId.ToString();
 
           e.Item.Attributes.Add("Code", ((ISICClassification)e.Item.DataItem).Code);
           e.Item.Attributes.Add("Description", ((ISICClassification)e.Item.DataItem).Description);
           e.Item.Attributes.Add("DescriptionBI", ((ISICClassification)e.Item.DataItem).DescriptionBI);
           e.Item.Attributes.Add("DescriptionEn", ((ISICClassification)e.Item.DataItem).DescriptionEn);
           e.Item.Attributes.Add("RecordId", ((ISICClassification)e.Item.DataItem).RecordId.ToString());
 
           e.Item.DataBind();
       }
0
Plamen
Telerik team
answered on 10 Sep 2013, 12:19 PM
Hi Arun,


It sees that the issue is caused by the way you add your Ajax Settings. Please refer how such we recommend to add such settings programmatically in this help topic and here.

Hope this will be helpful.

Regards,
Plamen
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Arun Kumar
Top achievements
Rank 2
answered on 11 Sep 2013, 07:04 AM
Hi Plamen,

Thanks for your reply.

I am doing the same settings as mentioned in the attached sample project. If I execute the sample project it is working fine. Only difference is I am using visual studio 2012 for development and Visual Web Part template is slightly different from attached project. I am new to SharePoint development. Could you provide me a sample solution ?

Thanks in advance.
0
Plamen
Telerik team
answered on 16 Sep 2013, 07:24 AM
Hi Arun,

 
I have inspected the code that you are using and I noticed that you are adding the RadAjaxManager on Init and in a different way than it is explained in the help article. Please try to add it on load as described and  set its setting as described too. If you still observe issues please share your updated code once again so we could be more helpful.

Regards,
Plamen
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
General Discussions
Asked by
Makoto
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Kishore
Top achievements
Rank 1
Cat Cheshire
Top achievements
Rank 1
Dennis Schroder
Top achievements
Rank 1
Tsvetoslav
Telerik team
Ronak
Top achievements
Rank 1
Plamen
Telerik team
Arun Kumar
Top achievements
Rank 2
Share this question
or