Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
327 views
Hello,

I am getting a JavaScript error when I call my javascript function from the OnClientDropDownClosed client-side event from the RadComboBox control.

The error I get is the following:

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.


msigman
Top achievements
Rank 2
 answered on 14 Jun 2013
2 answers
92 views
Hi guys,
Ultimately, I am trying to build an xml string from the checked nodes in the treeview, though I'm having issues trying to retrieve the text and value fields from checked nodes when I have the treeview control bound to a sitemapdatasource and I was hoping you could help me out.
Thanks in advance!


My code-behind looks like:
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>");

Where the sitemap file looks like:
<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>

My markup is as follows:
<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>
Boyan Dimitrov
Telerik team
 answered on 14 Jun 2013
9 answers
420 views
<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 used the simple page above and it's not working for me - the multi select does not seem to be working correctly (drag and release mouse type). However the examples on your website work as expected. Could you please let me know what's wrong.
Tara Diebel
Telerik team
 answered on 14 Jun 2013
3 answers
126 views
Good day all,

we're trying to use a FileExplorer in a simple context: we require that the FileExplorer be defined in an user control. This user control is included in a site page that references a master page. The master page includes a Script manager.

When accessing the page that includes the user control with the fileexplorer, however, we receive the following error:

"The control with ID 'ajaxPanel' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it."


There's no 'ajaxPanel' component both in our page nor in our code.
The component is declared as thus inside the page:
                    <telerik:RadFileExplorer runat="server" ID="RadFileExplorer1"></telerik:RadFileExplorer>

When moving the component out from the user control into any web form using the masterpage, the fileexplorer works.
The user control references the masterpage using <%@ Reference Control="~/MasterPage.master"%>

It would seem that the radfileexplorer component is unable to dereference the scriptmanager inside the page. We've tried
RegisterWithScriptManager="false"
but this setting has no effect on the error.

So, how can we manually or dynamically assign an intended radscriptmanager to the radfileexplorer?
archimede
Top achievements
Rank 1
 answered on 14 Jun 2013
6 answers
231 views

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.


										
Keith
Top achievements
Rank 2
 answered on 14 Jun 2013
1 answer
100 views
Hello, 
I want to know capabilities telerik search box, asp.net ajax that can do this ?

Plamen
Telerik team
 answered on 14 Jun 2013
5 answers
260 views
Hi:
I have a scheduler in a content page.

How show and hide the resource types??

<telerik:RadScheduler ID="RadScheduler1" runat="server"
                            Skin="Sunset"
                            SelectedView="MonthView"
                           
                            onappointmentdelete="RadScheduler1_AppointmentDelete"
                            onappointmentinsert="RadScheduler1_AppointmentInsert"
                            onappointmentupdate="RadScheduler1_AppointmentUpdate" ShowViewTabs="False"
                             Width="60%" Culture="Spanish (Mexico)" onformcreated="RadScheduler1_FormCreated"
                             >
                      <ResourceTypes>
                            <telerik:ResourceType KeyField="ID" Name="Room" />     <--- databind in server side
                            <telerik:ResourceType KeyField="ID" Name="User" />                            
                         </ResourceTypes>
</telerik:RadScheduler>
tanks


Plamen
Telerik team
 answered on 14 Jun 2013
4 answers
1.6K+ views
I have been working with client script using RadButton, and noticed some odd behavior when calling args.set_cancel. During the OnClientClicking event, i check a condition, if true, button is allowed to postback, if false, set_cancel is set to true. I have two buttons using this event.

function OnClientClicking(sender, args) {
    if (somecondition == false) {
        args.set_cancel(true);
    }
}

Now, if I click Button1, and somecondition is false, then the postback will cancel. However, if I click Button2 next, when the OnClientClicking event is fired, somecondition is true, and set_cancel(true) is NOT called, but... the button does not post back. Now if I reload the page and click Button2 first, then it posts back, until i click Button1, then Button2 no longer posts back.

I tried explicitly calling args.set_cancel(false); 
but it still does not work right.

function OnClientClicking(sender, args) {
    if (somecondition == false) {
        args.set_cancel(true);
    } else {
        args.set_cancel(false);
    }
}

Any ideas what might be causing this weirdness?


Keith
Top achievements
Rank 2
 answered on 14 Jun 2013
2 answers
533 views
I have a column that has some long data values.  On unselected rows I would like the ItemStyle wrap="False".  And when I select a row I want the style for this column in the selected row to have wrap="True".  Is there a way to do this, either through configuration in the aspx or in client code?  I do have a client javascript function for the onRowSelected event where I could put some code.
Andy
Top achievements
Rank 1
Iron
 answered on 14 Jun 2013
1 answer
108 views
I am working on an Ektron webcalendar which is built onTelerik. I am using the selected date property to set the focus to a specific month on my calendar. After this is set the previous or next button on the top left corner will only work for the latest 2 months.
for ex - If I set the focus to July, then the prev or next button will only allow me to see June and August.
Any help is greatly appreciated.

if (focuDate != DateTime.MinValue)
        {
            Telerik.Web.UI.RadScheduler scheduler = (Telerik.Web.UI.RadScheduler)WebCalendar1.Controls[0];
            scheduler.SelectedDate = focuDate;
        }

Boyan Dimitrov
Telerik team
 answered on 14 Jun 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?