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

Programmatically check that AjaxSetting already exists

1 Answer 88 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
chawkins
Top achievements
Rank 1
chawkins asked on 02 Apr 2013, 07:20 PM
Hello

Is there a way to programmatically check server-side for an ajaxsetting that may or may not already exist in the AjaxSettings collection for the ajax manager? I thought a function like this one should do it, to create a setting object (='mytestsetting') against which then you could use it as a parameter to match against myajaxmanager.AjaxSettings.Contains(mytestsetting), but should I expect it to recognize that a matching setting with the exact same ajaxified source and updated target already exist?

        Public Function CheckForExistingAjaxSetting(ByRef ajaxifiedctrl As Control, ByRef updatedctrl As Control, ByRef rlp As RadAjaxLoadingPanel) As AjaxSetting

            Dim setting As New AjaxSetting()
            Dim target As AjaxUpdatedControl = Nothing
            If Not rlp Is Nothing Then
                target = New AjaxUpdatedControl(updatedctrl.UniqueID, rlp.UniqueID)
            Else
                target = New AjaxUpdatedControl(updatedctrl.UniqueID, Nothing)
            End If
            setting.UpdatedControls.Add(target)
            setting.AjaxControlID = ajaxifiedctrl.UniqueID
            Return setting

        End Function


 somewhere else in server code:

       Dim mytestsetting As AjaxSetting = CheckForExistingAjaxSetting(foo, bar, loadingpanel)
       If
Not (myajaxmanager.AjaxSettings.Contains(mytestsetting)) Then ....
           
.... add the setting programmatically
       End If


Could you say if there is a better way to do this that works?

Thankyou

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 05 Apr 2013, 11:43 AM
Hi,

The presented approach for verify if a concrete ajax settings exists is correct one and should work as expected. Do let us know if any issues with the presented approach appears.

Kind regards,
Maria Ilieva
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
Ajax
Asked by
chawkins
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or