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

Best Place to remove "OnRequestStart" Client Event

5 Answers 64 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Markus
Top achievements
Rank 2
Markus asked on 14 Jul 2008, 01:39 PM
Hello!

I have a control that performs a fileupload. As fileupload won't work with ajax, I have to ensure that the "upload" events excludes itself from any ajax callback.
So the control searches for an ajax mgr in the hierarchy, and if it finds one, it adds the OnRequestStartEvent.

Now the problem is: If the control gets generated automatically and is removed from the page after a postback, the OnRequestStart Event is still registered in the Ajaxmanager, but the corresponding sourcecode is gone - which of course results in a javascript exception.

What can I do, to remove the OnRequestStart Event from the ajax mgr. again?

Are there other possibilities that let me exclude a control form ajaxcallbacks?!

Thx in advance & kind regards

5 Answers, 1 is accepted

Sort by
0
Markus
Top achievements
Rank 2
answered on 14 Jul 2008, 02:03 PM
hmm... does this approach still work?
http://www.telerik.com/help/aspnet/ajax/ajxexclude.html

The method is called as expected, but still an ajaxpostback is made.
0
Markus
Top achievements
Rank 2
answered on 14 Jul 2008, 02:59 PM
my monologue continues:

As this approach (http://www.telerik.com/help/aspnet/ajax/ajxexclude.html) doesn't work at all, I tried something similar but still different :)

I register a javascript block in the parent page:

[code]
string javascript = "<script type=\"text/javascript\">function realPostBack(eventTarget, eventArgument)"
                                    + "{ " + mgr.ClientID + ".set_enableAJAX(false); "
                                    + "__doPostBack(eventTarget, eventArgument); }</script>";

                mgr.Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "onrequeststartaddfilecontrol", javascript);
[/code]

and add and onclientclick event to every button that should exclude itself.
I'm kinda upset whether to use clientId or UniqueId! Pls. suggest something!

Is this approach allright or do i have to fear some other obstacles now?
thx in advance & kind regards
0
Yavor
Telerik team
answered on 15 Jul 2008, 12:06 PM
Hi Markus,

I have addressed the issue posted here in the support ticket that you have opened on the matter.
Please, refer to it for additional information. To avoid duplicate posts, we can continue our correspondence there.

Kind regards,
Yavor
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Chris Castle
Top achievements
Rank 1
answered on 04 Nov 2008, 07:44 AM
Can you post the summary?  I have a very similar issue.
0
Yavor
Telerik team
answered on 04 Nov 2008, 08:02 AM
Hello Chris,

This is an excerpt from the support ticket:

Indeed, if the following code:

.aspx
 <telerik:GridTemplateColumn> 
                    <ItemTemplate> 
                        <uc2:WebUserControl ID="WebUserControl2" runat="server" />                          
                    </ItemTemplate> 
                    <EditItemTemplate> 
                        <uc2:WebUserControl ID="WebUserControl3" runat="server" /> 
                    </EditItemTemplate> 
                </telerik:GridTemplateColumn> 

is commented out, there will be a JavaScript error. The reason for this is that the userControl, which contains the Js function, added to the onRequestStart handler of the Manager is not available, and is loaded at a later stage, when a node is expanded (i.e. when the user control in the detail table is shown). The most straightforward approach in this case would be to set:

.aspx
<MasterTableView HierarchyLoadMode="Client"

This will pre-load the user control nested in the detail table, and eliminate the problem.

Best wishes,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Ajax
Asked by
Markus
Top achievements
Rank 2
Answers by
Markus
Top achievements
Rank 2
Yavor
Telerik team
Chris Castle
Top achievements
Rank 1
Share this question
or