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

What If Ajaxified Control and Updated Control Are The Same...

1 Answer 15 Views
WebParts for SharePoint
This is a migrated thread and some comments may be shown as answers.
Courtney
Top achievements
Rank 1
Courtney asked on 09 Sep 2014, 01:01 AM
In the AddAjaxSetting(Control ajaxifiedControl, Control updatedControl) method, is it ok for both Control arguments to be the same object? For example:

radAjaxMgr1.AjaxSettings.AddAjaxSetting(myCustomEditor, myCustomEditor);

 myCustomEditor is of the type WebControl. It looks like myCustomEditor is going to respond to some client-side action on itself, but is that allowed by the RadAjaxManager?

Thanks!

1 Answer, 1 is accepted

Sort by
0
Accepted
Konstantin Dikov
Telerik team
answered on 11 Sep 2014, 11:23 AM
Hello Courtney,

The AjaxControlID in the AjaxSettings of the RadAjaxManager specifies for which controls to enable AJAX. The UpdatedControls collection in other hand specifies which controls should be updated when an AJAX request in initiated from the AjaxControlID from the AjaxSettings.

Having the above in mind, if you want to update the control initiating the AJAX request, you could add it in the UpdatedControls collection.

I think that the following examples will help you understand how exactly those settings work.

1) One control as initiator and one control to be updated:
<telerik:RadAjaxManager runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadButton1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadButton2" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
 
<telerik:RadButton runat="server" ID="RadButton1"></telerik:RadButton>
<telerik:RadButton runat="server" ID="RadButton2"></telerik:RadButton>

And the code-behind:
protected void Page_Load(object sender, EventArgs e)
{
    RadButton1.Text = DateTime.Now.ToString();
    RadButton2.Text = DateTime.Now.ToString(); 
}

As you can see, clicking on the first button initiates an AJAX request, but updates only the second button, because it is the only one in the UpdatedControls collection.

2) One control as initiator, but two controls in the UpdatedControls:
<telerik:RadAjaxManager runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadButton1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadButton1" />
                <telerik:AjaxUpdatedControl ControlID="RadButton2" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
 
<telerik:RadButton runat="server" ID="RadButton1"></telerik:RadButton>
<telerik:RadButton runat="server" ID="RadButton2"></telerik:RadButton>

In this scenario, both of the buttons will be updated.

Hope this helps.


Regards,
Konstantin Dikov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
WebParts for SharePoint
Asked by
Courtney
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or