JavaScript critical error in (unknown source location)
SCRIPT1009: Expected '}'
My javascript is the following
<script type="text/javascript"> function displaySelectedValues() { debugger; var combo = $find("<%# RadComboBox1.ClientID %>"); alert(combo.get_checkedItems().length); //for (var i = 0; i < dropdown.get_checkedItems().length; i++) { // var text = dropdown.get_items().get_text(); // label.value = label.value + text; //} }</script>I use <%# instead of <%= because I get an error from visual studio, but regardless of which one I use I still receive the javascript error mentioned above.
The visual studio error is the following:
The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
I'm not sure if this is related to telerik or not, but if I have <%= visual studio wont even allow me to get on the page.
My markup code is as follows
<telerik:RadAjaxPanel runat="server" ID="rapConfiguration" LoadingPanelID="ralpConfiguration"> <telerik:RadWindow ID="modalPopup" runat="server" Width="650px" Height="325px" Modal="true" Behaviors="Close"> <ContentTemplate> <table style="padding:10px;"> <tr> bunch of td tags </tr <tr> <td style="vertical-align:top;"> </td> <td style="vertical-align:top;"> </td> <td style="vertical-align:top;"> <asp:CheckBox id="cbElementValue" runat="server" Visible="false" Text="Check = Yes/True"/> <telerik:RadCalendar ID="calElementValue" runat="server" Width="200px" RangeSelectionMode="None" EnableMultiSelect="false"></telerik:RadCalendar> <asp:TextBox ID="txtBoxElementValue" runat="server" Width="200px"></asp:TextBox> <telerik:RadComboBox ID="RadComboBox1" runat="server" CheckBoxes="true" EnableCheckAllItemsCheckBox="true" Visible="false" Label="Look up values:" OnClientDropDownClosed="displaySelectedValues();"> </telerik:RadComboBox> </td> <td style="vertical-align:top;"> <asp:CheckBox ID="chkExpression" runat="server" Visible="false" OnClick="checkExpression(this);"/> </td> </tr> </table> <div> <asp:Label runat="server" ID="lblSelectedValues" Text="testing, one, two, three">Selected Values: </asp:Label> </div> <div class="bottomRight"> <asp:Button runat="server" ID="btnSubmitValues" Text="Submit Values" OnClick="btnSubmitValues_Click" /> </div> </ContentTemplate> </telerik:RadWindow></telerik:RadAjaxPanel>I tried moving the RadComboBox outside the table and I still got the error, I tried not passing in a value to the javascript function and I still got an error, because originally I was passing in "this" to the javascript function from the RadComboBox event property. Such as
OnClientDropDownClosed="displaySelectedValues(this);"
Do you have any advice on how I can get past this error?
After I receive the error and choose to continue through it the control still loads on the page but is unclickable, I can't open the dropdown list or type in the combobox.
StringBuilder pagecfg = new StringBuilder();pagecfg.AppendLine("<pageconfig>");IList<RadTreeNode> nodeCollection = rtvSitemap.CheckedNodes;foreach (RadTreeNode node in nodeCollection){ pagecfg.AppendLine(string.Format("<page title='{0}' url='{1}' />",node.Text, node.Value)); }pagecfg.AppendLine("</pageconfig>");<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" enableLocalization="true"><siteMapNode title="$resources:SiteMapLocalizations,HomePageTitle" url="~/default.aspx" description="$resources:SiteMapLocalizations,HomePageDescription" Expanded="false" /><siteMapNode title="$resources:SiteMapLocalizations,PartSectionTitle" url="" description="$resources:SiteMapLocalizations,PartSectionDescription" Expanded="true" ><siteMapNode title="$resources:SiteMapLocalizations,PartPageTitle" url="~/Pages/Production/ProdPart.aspx" description="$resources:SiteMapLocalizations,PartPageDescription" SecAccess="Production" /></siteMapNode></siteMap><telerik:RadTreeView ID="rtvSitemap" runat="server" DataSourceID="dsSiteMap" CheckBoxes="true" MultipleSelect="true" CheckChildNodes="True" DataModelID="Title" DataNavigateUrlField="Url"> <DataBindings><telerik:RadTreeNodeBinding Expanded="true" TextField="title" ValueField="url" /></DataBindings> </telerik:RadTreeView><telerik:RadScriptManager ID="RadScriptManager1" Runat="server"> </telerik:RadScriptManager> <telerik:RadListBox ID="RadListBox1" runat="server" SelectionMode="Multiple" AutoPostBack="true"> <Items> <telerik:RadListBoxItem Text="1" /> <telerik:RadListBoxItem Text="2" /> <telerik:RadListBoxItem Text="3" /> <telerik:RadListBoxItem Text="1" /> <telerik:RadListBoxItem Text="2" /> <telerik:RadListBoxItem Text="3" /> </Items> </telerik:RadListBox>I am working on breaking down very complex aspx files into smaller more manageable chunks by breaking out duplicated sections of code. So far this has worked out well, however, in some instances, the resulting control requires a window manager. This isn't a problem until more than one control is used that requires a window manager.
However, when including more than one control, a window manager is created for each control. Again, this isn't a huge problem, except that it duplicates javascript functions on the page so that there are multiple functions with the same name and code, for example
function RadWindowprompt_detectenter(id, ev, input)
This isn't my code, but code injected into the resulting html page to handle events for the radwindows.
Is the only solution to place a single windowmanager in the master page and then try and find it in the codebehind and then edit it programmatically to add window templates as needed?
I'd like to remove the duplicates because additional window managers simply add more overhead to the page.
I'll entertain any ideas to make it more efficient.


function OnClientClicking(sender, args) { if (somecondition == false) { args.set_cancel(true); }}args.set_cancel(false);
function OnClientClicking(sender, args) {
if (somecondition == false) {
args.set_cancel(true);
} else {
args.set_cancel(false);
}
}
Any ideas what might be causing this weirdness?