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

RadAjaxManager Issue in Master/Content Page

1 Answer 201 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
PPSDevs
Top achievements
Rank 1
PPSDevs asked on 21 Feb 2010, 10:21 PM
I have Master Page and a Content page and I am trying to ajaxify content page. I am using RadAjaxManager to do that.

AS soon as I drop a RadCombobox on the content page  with AutoPostback=True and use it with the RadAjaxManager as the control that updates other controls, I get 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. <% ... %>).

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[HttpException (0x80004005): The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).]
   System.Web.UI.ControlCollection.AddAt(Int32 index, Control child) +8668018
   Telerik.Web.UI.RadAjaxControl.MoveUpdatePanel(Control initiator, Control updated) +133

[HttpException (0x80004005): Please, see whether wrapping the code block, generating the exception, within RadCodeBlock resolves the error.]
   Telerik.Web.UI.RadAjaxControl.MoveUpdatePanel(Control initiator, Control updated) +181
   Telerik.Web.UI.RadAjaxControl.PerformRender() +375
   Telerik.Web.UI.RadAjaxControl.OnPageRender(HtmlTextWriter writer, Control page) +1222
   Telerik.Web.UI.RadAjaxControl.RenderPageInAjaxMode(HtmlTextWriter writer, Control page) +95
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +256
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
   System.Web.UI.Page.Render(HtmlTextWriter writer) +29
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1266


Version Information: Microsoft .NET Framework Version:2.0.50727.3082; ASP.NET Version:2.0.50727.3082 
 

Here is my ContentPage:

<%

@ Page Title="" Language="C#" MasterPageFile="~/Fac_MasterPage.master" AutoEventWireup="true" CodeBehind="CreateReferral.aspx.cs" Inherits="PatientPlacement.WebLayer.RMS.complete.referrals.CreateReferral" %>

 

<%

@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

 

<

 

asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

 

 

<telerik:RadAjaxManagerProxy ID="ramCreateReferral" runat="server">

 

 

<AjaxSettings>

 

 

<telerik:AjaxSetting AjaxControlID="rcbReferralLocation" EventName="SelectedIndexChanged">

 

 

<UpdatedControls>

 

 

<telerik:AjaxUpdatedControl ControlID="rcbReferralLocation" />

 

 

</UpdatedControls>

 

 

</telerik:AjaxSetting>

 

 

</AjaxSettings>

 

 

</telerik:RadAjaxManagerProxy>

 

 

 

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

 

 

<script language="javascript" type="text/javascript">

 

 

function SetDate(datePicker)

 

{

datePicker.SetDate(

new Date());

 

}

 

 

function SetCalendarDate(n)

 

{

 

var calendar;

 

 

switch (n)

 

{

 

case "Document Date":

 

calendar = $find(

"<%=rdpDocumentDate.ClientID %>");

 

 

break;

 

}

calendar.set_selectedDate(

new Date());

 

}

 

 

function DropDownClosed(sender, eventArgs)

 

{

 

var item = eventArgs.get_item();

 

 

var picker = $find("<%= rdpDocumentDate.ClientID %>");

 

 

CreateDocumentName(item.get_text().toString(), picker.get_selectedDate().format(

"d").toString());

 

}

 

 

function DateSelected(sender, eventArgs)

 

{

 

var comboBox = $find("<%= rcbDocumentType.ClientID %>");

 

CreateDocumentName(comboBox.get_text().toString(), eventArgs.get_newValue().toString());

}

 

function CreateDocumentName(type, date)

 

{

 

var textBox = $find("<%= rtbDocumentName.ClientID %>");

 

textBox.set_value(type.toString() +

'-' + date.toString());

 

}

 

function KeyPressed(sender, args) {

 

 

if (args.get_domEvent().rawEvent.keyCode == 13) // ENTER key pressed

 

{

args.get_domEvent().preventDefault();

args.get_domEvent().stopPropagation();

}

 

if (args.get_domEvent().rawEvent.keyCode == 27) // ESC key pressed

 

{

args.get_domEvent().preventDefault();

args.get_domEvent().stopPropagation();

}

}

 

</script>

 

 

</telerik:RadCodeBlock>

 

 

<table border="1" cellpadding="0" cellspacing="0" style="width:100%;">

 

 

<tr>

 

 

<td>

 

Document Type

 

</td>

 

 

<td>

 

 

<telerik:RadComboBox ID="rcbDocumentType" runat="server"

 

 

Skin="Office2007"

 

 

MaxHeight="125px"

 

 

OnClientSelectedIndexChanged="DropDownClosed">

 

 

<Items>

 

 

<telerik:RadComboBoxItem Text="" />

 

 

<telerik:RadComboBoxItem Text="Assessment" />

 

 

<telerik:RadComboBoxItem Text="Chest X-Ray" />

 

 

<telerik:RadComboBoxItem Text="Client Update" />

 

 

<telerik:RadComboBoxItem Text="Consultation" />

 

 

<telerik:RadComboBoxItem Text="Dietary Notes" />

 

 

<telerik:RadComboBoxItem Text="Discharge Planning Record" />

 

 

<telerik:RadComboBoxItem Text="Discharge Summary" />

 

 

<telerik:RadComboBoxItem Text="DME Orders" />

 

 

<telerik:RadComboBoxItem Text="Face Sheet" />

 

 

<telerik:RadComboBoxItem Text="Graphic I &amp; O" />

 

 

<telerik:RadComboBoxItem Text="H &amp; P" />

 

 

<telerik:RadComboBoxItem Text="Home Health Orders" />

 

 

<telerik:RadComboBoxItem Text="Insurance Certification" />

 

 

<telerik:RadComboBoxItem Text="Labs" />

 

 

<telerik:RadComboBoxItem Text="Level 1" />

 

 

<telerik:RadComboBoxItem Text="Level 1 Letter of Determination" />

 

 

<telerik:RadComboBoxItem Text="Medical Necessity" />

 

 

<telerik:RadComboBoxItem Text="Medicare IM/CMS-R-193" />

 

 

<telerik:RadComboBoxItem Text="Medicare IM/Discharge Appeal Rights Form " />

 

 

<telerik:RadComboBoxItem Text="Medication Administration Record (MAR)" />

 

 

<telerik:RadComboBoxItem Text="Medical Documents" />

 

 

<telerik:RadComboBoxItem Text="MMSE" />

 

 

<telerik:RadComboBoxItem Text="Nursing Home Orders" />

 

 

<telerik:RadComboBoxItem Text="Patient Choice Form" />

 

 

<telerik:RadComboBoxItem Text="Progress Notes" />

 

 

<telerik:RadComboBoxItem Text="PT Notes" />

 

 

<telerik:RadComboBoxItem Text="Speech Therapy Notes" />

 

 

<telerik:RadComboBoxItem Text="Therapy Evaluation and Progress Notes" />

 

 

</Items>

 

 

</telerik:RadComboBox>

 

 

</td>

 

 

<td>

 

Document Date

 

</td>

 

 

<td>

 

 

<telerik:RadDatePicker ID="rdpDocumentDate" runat="server"

 

 

Skin="Office2007"

 

 

Width="90px">

 

 

<Calendar ID="calDocumentDate" runat="server"

 

 

ShowRowHeaders="false"></Calendar>

 

 

<ClientEvents OnDateSelected="DateSelected" />

 

 

</telerik:RadDatePicker>&nbsp;

 

 

<asp:LinkButton ID="lnkSetDocumentDate" runat="server"

 

 

OnClientClick="SetCalendarDate('Document Date'); return false;"

 

 

CausesValidation="false">Today</asp:LinkButton>

 

 

</td>

 

 

<td>

 

Document Name

 

</td>

 

 

<td>

 

 

<telerik:RadTextBox ID="rtbDocumentName" runat="server"

 

 

MaxLength="50"

 

 

TextMode="SingleLine"

 

 

Width="200px">

 

 

</telerik:RadTextBox>

 

 

<asp:RequiredFieldValidator ID="rfvDocumentName" runat="server"

 

 

ControlToValidate="rtbDocumentName"

 

 

ErrorMessage="Referral owner is required."

 

 

SetFocusOnError="true">* Required

 

 

</asp:RequiredFieldValidator>

 

 

</td>

 

 

</tr>

 

 

</table>

 

 

<table width="430px" cellpadding="2" cellspacing="1" class="table-display">

 

 

<tr class="tr-header">

 

 

<td colspan="6">

 

 

<img src='<%= ResolveUrl("~/images/bullet_action_sm.gif") %>' />

 

PATIENT DATA

 

</td>

 

 

</tr>

 

 

<tr>

 

 

<td>

 

First Name

 

</td>

 

 

<td>

 

 

<telerik:RadTextBox ID="txtFirstName" runat="server"

 

 

MaxLength="50"

 

 

TextMode="SingleLine"

 

 

AutoCompleteType="FirstName"

 

 

ClientEvents-OnKeyPress="KeyPressed">

 

 

</telerik:RadTextBox>

 

 

<asp:RequiredFieldValidator ID="rfvFirstName" runat="server"

 

 

ControlToValidate="txtFirstName"

 

 

ErrorMessage="First name is required."

 

 

SetFocusOnError="true"

 

 

ValidationGroup="vgpCreateReferral">* Required

 

 

</asp:RequiredFieldValidator>

 

 

</td>

 

 

<td>

 

Middle Initial

 

</td>

 

 

<td>

 

 

<telerik:RadTextBox ID="txtMiddleInitial" runat="server"

 

 

MaxLength="1"

 

 

TextMode="SingleLine">

 

 

</telerik:RadTextBox>

 

 

</td>

 

 

<td>

 

Last Name

 

</td>

 

 

<td>

 

 

<telerik:RadTextBox ID="txtLastName" runat="server"

 

 

MaxLength="50"

 

 

TextMode="SingleLine"

 

 

AutoCompleteType="FirstName"

 

 

ClientEvents-OnKeyPress="KeyPressed">

 

 

</telerik:RadTextBox>

 

 

<asp:RequiredFieldValidator ID="rfvLastName" runat="server"

 

 

ControlToValidate="txtLastName"

 

 

ErrorMessage="Last name is required."

 

 

SetFocusOnError="true"

 

 

ValidationGroup="vgpCreateReferral">* Required

 

 

</asp:RequiredFieldValidator>

 

 

</td>

 

 

</tr>

 

 

<tr>

 

 

<td>Gender</td>

 

 

<td>

 

 

<asp:RadioButtonList ID="rblGender" runat="server"

 

 

RepeatColumns="3"

 

 

RepeatDirection="Horizontal">

 

 

<asp:ListItem Value="F" Text="Female"></asp:ListItem>

 

 

<asp:ListItem Value="M" Text="Male"></asp:ListItem>

 

 

<asp:ListItem Value="U" Text="Unknown"></asp:ListItem>

 

 

</asp:RadioButtonList>

 

 

</td>

 

 

<td>DOB</td>

 

 

<td>

 

 

<telerik:RadDateInput ID="rdpDateOfBirth" runat="server" Width="90px" Skin="Office2007" ClientEvents-OnKeyPress="KeyPressed">

 

 

</telerik:RadDateInput>

 

 

</td>

 

 

<td>SSN</td>

 

 

<td>

 

 

<telerik:RadMaskedTextBox ID="txtSSN" runat="server"

 

 

Mask="###-##-####"

 

 

ClientEvents-OnKeyPress="KeyPressed">

 

 

</telerik:RadMaskedTextBox>

 

 

<asp:RegularExpressionValidator ID="revSSN" runat="server"

 

 

ControlToValidate="txtSSN"

 

 

ErrorMessage="Enter SSN in XXX-XX-XXXX format"

 

 

SetFocusOnError="true"

 

 

Display="Dynamic"

 

 

ValidationExpression="\d{3}-\d{2}-\d{4}"

 

 

ValidationGroup="vgpCreateReferral" >* Invalid

 

 

</asp:RegularExpressionValidator>

 

 

</td>

 

 

</tr>

 

 

<tr>

 

 

<td>Address<br /><br />City State Zip</td>

 

 

<td>

 

 

<telerik:RadTextBox ID="txtAddress1" runat="server"

 

 

MaxLength="50"

 

 

ClientEvents-OnKeyPress="KeyPressed">

 

 

</telerik:RadTextBox><br />

 

 

<telerik:RadTextBox ID="txtAddress2" runat="server"

 

 

MaxLength="50"

 

 

ClientEvents-OnKeyPress="KeyPressed">

 

 

</telerik:RadTextBox><br />

 

 

<telerik:RadTextBox ID="txtCity" runat="server"

 

 

MaxLength="50"

 

 

ClientEvents-OnKeyPress="KeyPressed">

 

 

</telerik:RadTextBox>

 

 

<telerik:RadComboBox ID="rcbState" runat="server"

 

 

DataSourceID="odsStates"

 

 

DataTextField="Description"

 

 

DataValueField="StateID"

 

 

AppendDataBoundItems="True"

 

 

MarkFirstMatch="True"

 

 

Skin="Office2007"

 

 

MaxHeight="125px">

 

 

<Items>

 

 

<telerik:RadComboBoxItem ID="RadComboBoxItem14" runat="server"

 

 

Selected="True"

 

 

Text="- Select a state -"

 

 

Value="0">

 

 

</telerik:RadComboBoxItem>

 

 

</Items>

 

 

</telerik:RadComboBox>

 

 

<asp:ObjectDataSource ID="odsStates" runat="server"

 

 

SelectMethod="GetStatesDataView"

 

 

TypeName="PPS_LIB.Utilities.Tools">

 

 

</asp:ObjectDataSource>

 

 

<telerik:RadMaskedTextBox ID="txtZIPCode" runat="server"

 

 

Mask="#####-####"

 

 

Style="TEXT-ALIGN:left"

 

 

ClientEvents-OnKeyPress="KeyPressed">

 

 

</telerik:RadMaskedTextBox>

 

 

<asp:RegularExpressionValidator ID="revZIPCode" runat="server"

 

 

ControlToValidate="txtZIPCode"

 

 

ErrorMessage="Enter ZIP in 99999 or 99999-9999 format."

 

 

SetFocusOnError="true"

 

 

Display="Dynamic"

 

 

ValidationExpression="(^\d{5}-$)|(^\d{5}-\d{4}$)"

 

 

ValidationGroup="vgpCreateReferral" >* Invalid

 

 

</asp:RegularExpressionValidator>

 

 

</td>

 

 

<td>Phone<br />Mobile<br />Fax</td>

 

 

<td>

 

 

<telerik:RadMaskedTextBox ID="txtPhone" runat="server"

 

 

Mask="###-###-####"

 

 

MaxLength="14"

 

 

ClientEvents-OnKeyPress="KeyPressed">

 

 

</telerik:RadMaskedTextBox>

 

 

<asp:RegularExpressionValidator ID="revPhone" runat="server"

 

 

ControlToValidate="txtPhone"

 

 

ErrorMessage="Enter phone number in 999-999-9999 format."

 

 

SetFocusOnError="true"

 

 

Display="Dynamic"

 

 

ValidationExpression="^\d{3}-\d{3}-\d{4}$"

 

 

ValidationGroup="vgpCreateReferral" >* Invalid

 

 

</asp:RegularExpressionValidator><br />

 

 

<telerik:RadMaskedTextBox ID="txtMobilePhone" runat="server"

 

 

Mask="###-###-####"

 

 

MaxLength="14"

 

 

ClientEvents-OnKeyPress="KeyPressed">

 

 

</telerik:RadMaskedTextBox>

 

 

<asp:RegularExpressionValidator ID="revMobilePhone" runat="server"

 

 

ControlToValidate="txtMobilePhone"

 

 

ErrorMessage="Enter mobile phone number in 999-999-9999 format."

 

 

SetFocusOnError="true"

 

 

Display="Dynamic"

 

 

ValidationExpression="^\d{3}-\d{3}-\d{4}$"

 

 

ValidationGroup="vgpCreateReferral" >* Invalid

 

 

</asp:RegularExpressionValidator><br />

 

 

<telerik:RadMaskedTextBox ID="txtFax" runat="server"

 

 

Mask="###-###-####"

 

 

MaxLength="14"

 

 

ClientEvents-OnKeyPress="KeyPressed">

 

 

</telerik:RadMaskedTextBox>

 

 

<asp:RegularExpressionValidator ID="revFax" runat="server"

 

 

ControlToValidate="txtFax"

 

 

ErrorMessage="Enter fax number in 999-999-9999 format."

 

 

SetFocusOnError="true"

 

 

Display="Dynamic"

 

 

ValidationExpression="^\d{3}-\d{3}-\d{4}$"

 

 

ValidationGroup="vgpCreateReferral" >* Invalid

 

 

</asp:RegularExpressionValidator>

 

 

</td>

 

 

<td>E-mail</td>

 

 

<td>

 

 

<telerik:RadTextBox ID="txtEmail" runat="server"

 

 

MaxLength="100"

 

 

ClientEvents-OnKeyPress="KeyPressed">

 

 

</telerik:RadTextBox>

 

 

<asp:RegularExpressionValidator ID="revEmail" runat="server"

 

 

ControlToValidate="txtEmail"

 

 

ErrorMessage="Enter email in name@organization.com format."

 

 

SetFocusOnError="true"

 

 

Display="Dynamic"

 

 

ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"

 

 

ValidationGroup="vgpCreateReferral">* Invalid

 

 

</asp:RegularExpressionValidator>

 

 

</td>

 

 

</tr>

 

 

<tr>

 

 

<td>

 

Organization

 

</td>

 

 

<td colspan="5">

 

 

<telerik:RadComboBox ID="rcbReferralLocation" runat="server" AutoPostBack="True"

 

 

DataTextField="Name" DataValueField="FacilityID"

 

 

NoWrap="True"

 

 

Width="255px" MaxHeight="125px"

 

 

MarkFirstMatch="True"

 

 

Skin="Office2007"

 

 

OnDataBound="rcbReferralLocation_DataBound">

 

 

</telerik:RadComboBox>

 

 

<asp:RequiredFieldValidator ID="rfvReferralLocation" runat="server"

 

 

ControlToValidate="rcbReferralLocation"

 

 

ErrorMessage="Organization is required."

 

 

InitialValue="- Select an organization -"

 

 

ValidationGroup="vgpCreateReferral">* Required

 

 

</asp:RequiredFieldValidator>

 

 

<asp:ObjectDataSource ID="odsReferralLocations" runat="server"

 

 

SelectMethod="GetAvailableFacilitiesByUser"

 

 

TypeName="PPS_LIB.Facility.Facility">

 

 

<SelectParameters>

 

 

<asp:SessionParameter DefaultValue="0" SessionField="USERID" Name="UserID" Type="Int64" />

 

 

</SelectParameters>

 

 

</asp:ObjectDataSource>

 

 

</td>

 

 

</tr>

 

 

</table>

 

</

 

asp:Content>

As you can see my script code is inside the RadCodeBlock and I have very simple master page. Also, I have noticed that if I used and other standard ASP.NET control that causes the postback and I use it RadAjaxManager, I don't get the error mentioned above. I would appreciate if you would let me know a workaround to this problem. This is very urget and a quick response will be appreciated.

I am using RadControls for ASP.NET AJAX 2009 Q1.

Thanks,
Soor

 

1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 23 Feb 2010, 03:43 PM
Hello Manjeet,

From the provided code I can see you configured the RadAjaxManager setting properly and you also wrapped the client scripts in a RadCodeBlock as recommended. However I am not able to find the source of the error there.
Can you send a runnable version of the problematic page for further debugging and investigation?

Looking forward your reply,
Iana
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Ajax
Asked by
PPSDevs
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question
or