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

RadAjaxManager & JavaScript - need help

1 Answer 35 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Brian Garson
Top achievements
Rank 2
Brian Garson asked on 07 Apr 2011, 04:34 PM
Hello,

Maybe just having a bad day, but I can't figure out what I've done wrong.  When I introduced the RadAjaxManager to my page, one of my Javascript functions executes, does not throw any errors, but does not update the document.  If I remove the RadAjaxManager my Javascript executes properly.  The function called is previewStyle, and is called by this button: <asp:Button ID="previewCSS" runat="server" Text="Preview" OnClientClick="previewStyle(); return false;" />

<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <telerik:RadAjaxManager runat="server">
        <ajaxsettings>
            <telerik:AjaxSetting AjaxControlID="rgCampaignThemes">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rgCampaignThemes" LoadingPanelID="radAjaxLoadingPanel1" UpdatePanelHeight="" />
                    <telerik:AjaxUpdatedControl ControlID="editorCSS" LoadingPanelID="radAjaxLoadingPanel1" />
                </UpdatedControls>
                 
            </telerik:AjaxSetting>
        </ajaxsettings>
    </telerik:RadAjaxManager>
     
    <telerik:RadScriptBlock ID="radScriptBlock1" runat="server">
 
        <script src="../Scripts/jquery-1.5.js" type="text/javascript"></script>
 
        <script type="text/javascript" language="javascript">
     
    
    function previewStyle(){
        try{
        var editor = $find("<%=editorCSS.ClientID%>");
       //$('style[type="text/css"]').text(editor.get_html());
       var newStyleSheet = '<style type="text/css">' + editor.get_html() + '</style>';
       var filterVar = $('style[type="text/css"]');
       filterVar.replaceWith(newStyleSheet);
       }
       catch(e){
       alert(e);
       }
       }
        
         </script>
 
    </telerik:RadScriptBlock>
 
<telerik:RadAjaxLoadingPanel ID="radAjaxLoadingPanel1" runat="server">
                </telerik:RadAjaxLoadingPanel>
                <telerik:RadGrid Width="600px" ID="rgCampaignThemes" AllowSorting="True" Skin="WebBlue"
                    EnableLinqExpressions="False" runat="server" GridLines="None" AllowPaging="True"
                    OnNeedDataSource="rgCampaignThemesNeedDataSource" OnItemCreated="rgCampaignTheme_ItemCreated"
                    OnSelectedIndexChanged="rgCampaignThemes_SelectedIndexChanged" MasterTableView-NoDetailRecordsText="No Themes"
                    OnItemCommand="rgCampaignTheme_ItemCommand" OnDetailTableDataBind="rgCampaignTheme_DetailTableDataBind"
                    OnPreRender="rgCampaignTheme_preRender">
                    <mastertableview tablelayout="Fixed" clientdatakeynames="id" datakeynames="id" autogeneratecolumns="False"
                        allowfilteringbycolumn="true" allowsorting="true" allowpaging="true" pagesize="15"
                        pagerstyle-visible="true">
                        <DetailTables>
                            <telerik:GridTableView AutoGenerateColumns="false" NoDetailRecordsText="">
<CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
                            <Columns>
                                <telerik:GridButtonColumn CommandName="Select" Text="Select" UniqueName="Select">
                            </telerik:GridButtonColumn>
                            <telerik:GridBoundColumn DataField="id" HeaderText="Id" SortExpression="id" UniqueName="id"
                                AllowFiltering="true" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left" Visible="false" />
                            <telerik:GridBoundColumn DataField="themeName" HeaderText="Theme" SortExpression="themeName"
                                UniqueName="themeName" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left"
                                AllowFiltering="true" />
                            <telerik:GridBoundColumn DataField="paletteName" HeaderText="Palette" SortExpression="paletteName"
                                UniqueName="paletteName" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left"
                                AllowFiltering="true" />
                            <telerik:GridBoundColumn DataField="isActive" HeaderText="Active" SortExpression="isActive"
                                AllowFiltering="true" UniqueName="isActive" DataType="System.Boolean" HeaderStyle-HorizontalAlign="Center"
                                ItemStyle-HorizontalAlign="Center" />
                            <telerik:GridButtonColumn CommandName="ToggleActive" Text="Toggle Active" UniqueName="ToggleActive">
                            </telerik:GridButtonColumn>
                            <telerik:GridButtonColumn CommandName="GenerateImages" Text="Generate Images" UniqueName="GenerateImages">
                            </telerik:GridButtonColumn>
                            </Columns>
                                 
                            </telerik:GridTableView>
                        </DetailTables>
 
<CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
 
<ExpandCollapseColumn Visible="True"></ExpandCollapseColumn>
                        <Columns>
                            <telerik:GridButtonColumn CommandName="Select" Text="Select" UniqueName="Select" ItemStyle-Width="50px">
                            </telerik:GridButtonColumn>
                            <telerik:GridBoundColumn DataField="id" HeaderText="Id" SortExpression="id" UniqueName="id"
                                AllowFiltering="true" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left" Visible="false" />
                            <telerik:GridBoundColumn DataField="themeName" HeaderText="Theme" SortExpression="themeName"
                                UniqueName="themeName" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left"
                                AllowFiltering="true" HeaderStyle-Width="150px"/>
                                <telerik:GridBoundColumn DataField="paletteName" HeaderText="Palette" SortExpression="paletteName"
                                UniqueName="paletteName" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left"
                                AllowFiltering="true" />
                             
                            <telerik:GridBoundColumn DataField="isActive" HeaderText="Active" SortExpression="isActive"
                                AllowFiltering="true" UniqueName="isActive" DataType="System.Boolean" HeaderStyle-HorizontalAlign="Center"
                                ItemStyle-HorizontalAlign="Center" />
                             <telerik:GridBoundColumn DataField="ParentId" HeaderText="ParentId" SortExpression="ParentId" UniqueName="ParentId"
                                AllowFiltering="true" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left" Visible="false" />
                            <telerik:GridButtonColumn CommandName="ToggleActive" Text="Toggle Active" UniqueName="ToggleActive">
                            </telerik:GridButtonColumn>
                            <telerik:GridButtonColumn CommandName="GenerateImages" Text="Generate Images" UniqueName="GenerateImages">
                            </telerik:GridButtonColumn>
                            <telerik:GridButtonColumn CommandName="Up" Text="Up" UniqueName="Up">
                            </telerik:GridButtonColumn>
                            <telerik:GridButtonColumn CommandName="Down" Text="Down" UniqueName="Down">
                            </telerik:GridButtonColumn>
                        </Columns>
                    </mastertableview>
                </telerik:RadGrid>
                <br />
                <br />
                <asp:Literal runat="server" ID="layoutContent"></asp:Literal>
            </td>
            <td width="15px">
                  
            </td>
            <td width="50%" valign="top">
                <telerik:RadEditor runat="server" ID="editorCSS" EditModes="Html" AllowScripts="true"
                    ContentFilters="IndentHTMLContent" OnClientLoad="onClientLoad" Height="750">
                    <tools>
                        <telerik:EditorToolGroup>
                        </telerik:EditorToolGroup>
                    </tools>
                </telerik:RadEditor>
                Theme Name:
                <asp:TextBox ID="themeName" runat="server"></asp:TextBox>
                <br />
                Palette Name:
                <asp:TextBox ID="paletteName" runat="server"></asp:TextBox>
                <br />
                <asp:Button ID="previewCSS" runat="server" Text="Preview" OnClientClick="previewStyle(); return false;" />
</td>
....


thanks

1 Answer, 1 is accepted

Sort by
0
Cori
Top achievements
Rank 2
answered on 08 Apr 2011, 01:22 PM
Hello Brian,

Could it be some sort of conflict with the $ object? Have you tried using $telerik.$ and seeing if that resolves the issue?
Tags
Ajax
Asked by
Brian Garson
Top achievements
Rank 2
Answers by
Cori
Top achievements
Rank 2
Share this question
or