Programmatically check that AjaxSetting already exists

2 posts, 0 answers
  1. chawkins
    chawkins avatar
    3 posts
    Member since:
    Mar 2013

    Posted 02 Apr 2013 Link to this post


    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)
                    target = New AjaxUpdatedControl(updatedctrl.UniqueID, Nothing)
                End If
                setting.AjaxControlID = ajaxifiedctrl.UniqueID
                Return setting

            End Function

     somewhere else in server code:

           Dim mytestsetting As AjaxSetting = CheckForExistingAjaxSetting(foo, bar, loadingpanel)
    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?


  2. Maria Ilieva
    Maria Ilieva avatar
    4017 posts

    Posted 05 Apr 2013 Link to this post


    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.
  3. DevCraft R3 2016 release webinar banner
Back to Top