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

Ajax/Common/CancelAJax Eg Simulation in Master Pg gives error

1 Answer 40 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Lazurus
Top achievements
Rank 1
Lazurus asked on 10 Jul 2008, 12:24 PM

Dear All,

I am novice of Telerik Rad Control,

In Rad 2008 Ajax/Common/CancelAJax  eg  --> I am trying to do in Master Page - Content Placeholder - ASPX Page.
 
<telerik:RadAjaxPanel ID="RadAjaxPanel1" LoadingPanelID="RadAjaxLoadingPanel1" ClientEvents-OnRequestStart="OnRequestStart"

JAvASCRIPT FUNCTION
function OnRequestStart(ajaxPanel, eventArgs)
{
var eventTarget = eventArgs.EventTarget;
if (eventTarget == "<%= Button1.ClientID %>")
{
return false;
}
}

------------------
"<%= Button1.ClientID %>") is producing error as shown below
error :-
The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

 Please Help,..

Thanks in Advance,
Uday Kumar Lazurus

1 Answer, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 10 Jul 2008, 12:40 PM
Hello Lazurus,

You can place this script block in RadCodeBlock control. Here is an example:

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">
function OnRequestStart(ajaxPanel, eventArgs)
{
    var eventTarget = eventArgs.EventTarget;
    if (eventTarget == "<%= Button1.ClientID %>")
    {
        return false;
    }
}
</script>
</telerik:RadCodeBlock>

Sincerely yours,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Ajax
Asked by
Lazurus
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or