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

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

5 Answers 45 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Dave
Top achievements
Rank 1
Dave asked on 08 Mar 2011, 07:50 PM
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!!

5 Answers, 1 is accepted

Sort by
0
Kate
Telerik team
answered on 11 Mar 2011, 04:22 PM
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!
0
Dave
Top achievements
Rank 1
answered on 11 Mar 2011, 06:51 PM
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
0
Cori
Top achievements
Rank 2
answered on 15 Mar 2011, 01:11 PM
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.
0
Ben
Top achievements
Rank 1
answered on 15 Mar 2011, 04:25 PM
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. 
0
Kate
Telerik team
answered on 16 Mar 2011, 12:36 PM
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!
Tags
Upload (Obsolete)
Asked by
Dave
Top achievements
Rank 1
Answers by
Kate
Telerik team
Dave
Top achievements
Rank 1
Cori
Top achievements
Rank 2
Ben
Top achievements
Rank 1
Share this question
or