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

load on demand with confirmation

1 Answer 55 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Fred
Top achievements
Rank 1
Fred asked on 26 Mar 2012, 06:36 PM
Hi,
I have adapted the load on demand demo to show a confirmation box before load the next control. If the control currently loaded is in "Edit mode" i want to show a confirmation box, so i use the following code: 

protected void RadTabStrip1_TabClick(object sender, RadTabStripEventArgs e)
{
if
(isEdit)
  {
                
            RadTabStrip1.FindTabByText(LatestMenuItem).Selected = true;
            RadAjaxManager manager = RadAjaxManager.GetCurrent(this.Page);
            manager.ResponseScripts.Add("if(confirm('Are you sure?'))" + manager.ClientID + ".ajaxRequest('tab')");
  }
  else
   {
               LatestMenuItem = e.Tab.Text;
               string ctrl = e.Tab.Attributes["ctrl"] + ".ascx";
               LoadUserControl(ctrl,false);
               e.Tab.Selected = true;
     }
}

If the user click yes then i initiate an Ajax request to load the user control.

protected void ManagerAjaxRequest(object sender, AjaxRequestEventArgs e)
{
LoadUserControl(NewControlName,
true);
}

I also have the following RadAjax Settings on page:

<telerik:RadAjaxManagerProxy ID="RadAjaxManager1" runat="server" >
 <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadTabStrip1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadTabStrip1" />
                        <telerik:AjaxUpdatedControl ControlID="Panel1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                 
                <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadTabStrip1" />
                        <telerik:AjaxUpdatedControl ControlID="Panel1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
     
                     
 </telerik:RadAjaxManagerProxy>

If i debug the code i can see the control is loaded and added correctly, but nothing happens on the page. Any tips on load user controls in the ManagerAjaxRequest method?


Thanks.


1 Answer, 1 is accepted

Sort by
0
Dimitar Terziev
Telerik team
answered on 29 Mar 2012, 04:55 PM
Hi,

The reason for the experienced behavior are your Ajax settings. By default such setting is not a valid one when applied to the RadAjaxManagerProxy:
<telerik:RadAjaxManagerProxy ID="RadAjaxManager1" runat="server" >
 <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadTabStrip1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadTabStrip1" />
                        <telerik:AjaxUpdatedControl ControlID="Panel1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                  
                <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadTabStrip1" />
                        <telerik:AjaxUpdatedControl ControlID="Panel1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>                           
 </telerik:RadAjaxManagerProxy>

In scenarios like yours when you have RadAjaxManager with RadAjaxManagerProxy and need to add a setting that the manager will update a certain control than this setting should be added programmatically from code behind.

Greetings,
Dimitar Terziev
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.
Tags
TabStrip
Asked by
Fred
Top achievements
Rank 1
Answers by
Dimitar Terziev
Telerik team
Share this question
or