Unable to disable AJAX for a RadUpload in a nested user control

Thread is closed for posting
6 posts, 0 answers
  1. Dave
    Dave avatar
    9 posts
    Member since:
    Jan 2011

    Posted 08 Mar 2011 Link to this post

    I have a user control that consists of a RadUpload, RadProgressManager, RadProgressArea, and a button.  This user control is nested in another user control which is ajaxified by a RadAjaxManager.  I've scoured the forums and tried everything I came across, including adding a call to __doPostBack() and adding a handler to the RadAjaxManager to disable AJAX when my button raises the event.  My click event doesn't roll up to the outer user control or the page its on.  Any suggestions??? I can provide code if necessary, but I think my description makes the scenario clear.  Thanks!!
  2. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 11 Mar 2011 Link to this post

    Hello Dave,

    You can try to attach an event handler (the below mentioned conditionalPostback function) to the OnRequestStart event of the RadAjaxManager control. Here is the client-side function that you will need to implement:
    function conditionalPostback(sender, args) {
             if (args.get_eventTarget().indexOf('submit button id') > -1) {
                 args.set_enableAjax(false);
             }
         }


    Regards,
    Kate
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Dave
    Dave avatar
    9 posts
    Member since:
    Jan 2011

    Posted 11 Mar 2011 Link to this post

    Kate,

    Thanks for your reply.  I have tried to implement that exact conditionalPostback function with no success.  The wrench in the gears is that this request originates from a user control that is nested within another user control that is placed on a page have a RadAjaxManagerProxy that is attached to a Master Page with the RadAxajManager.  I cannot even add any JavaScript to the markup of my user control directly without it causing an error.  When I try adding this function using RadScriptManager.RegisterStartupScript, the function never even gets triggered.  I suspect this is because the RadAjaxManager cannot be found in the user control because it sits 3 levels above it.  Do you have any other suggestions?

    -Dave
  5. Cori
    Cori avatar
    562 posts
    Member since:
    Jul 2010

    Posted 15 Mar 2011 Link to this post

    Hello Dave,

    Have you tried the following in your user control:

    RadAjaxManager.GetCurrent(Page).ClientEvents.OnRequestStart =
    "function(sender,args){if (args.get_eventTarget().indexOf('Button1') > -1) { args.set_enableAjax(false);}}";

    I hope that helps.
  6. Ben
    Ben avatar
    1 posts
    Member since:
    Aug 2010

    Posted 15 Mar 2011 Link to this post

    Cori,

    Thanks for the reply.  I did try that, to no avail.  I ended up re-architected the app so I could meet my deadline.  I did want to leave this thread open though in case anyone else has this problem. 
  7. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 16 Mar 2011 Link to this post

    Hi Ben,

    Try using the following in your user control:
    protected void Page_Load(object sender, EventArgs e)
    {
    ClientScript.RegisterClientScriptBlock(Page.GetType(), "manager", string.Format("window['managerId'] = '{0}'", RadAjaxManager.GetCurrent(this).ClientID), true);
    }
    <script type="text/javascript">
     
    Sys.Application.add_load(function {$find(window["managerId"]).OnRequestStart = function(sender, args) {
    if (args.get_eventTarget().indexOf('submit button id') > -1) {args.set_enableAjax(false);}};});
     
    </script>


    Kind regards,
    Kate
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017