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:
|
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 & O" />
<telerik:RadComboBoxItem Text="H & 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>
<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