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

[Solved] Open Advanced editor in RadWindow from within a RadGrid

3 Answers 130 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Dominick DeStasio
Top achievements
Rank 1
Dominick DeStasio asked on 09 Feb 2010, 10:42 PM

I saw your demo on opening up an advanced RadEditor inside a RadWindow. For my purposes, I am using a RadGrid to display list of items that each contain a field to store html details about the item that needs to be able to be modified by the user when they update the item.

Due to space limitations, I do not have the room to display the full editor inside the edit item template for the grid. What I want to know is, would it be possible to implement the RadEditor in a RadWindow from within the edit item template of a grid?

In case that's confusing...a user click "edit" on an item in a grid...fills out all of the text fields, but then can launch the editor in a RadWindow to update the details before completing the update on the grid item.

I cut out some of the original grid code; however, the snippet below returns an error that DialogWindow does not exist in the current context. Before going any further I wanted to verify that there was no a limitation of the gridview that would prevent me from doing this...

Thanks,

<telerik:RadScriptManager ID="RadScriptManager1" runat="server" /> 
        <telerik:radgrid id="RadGrid2" runat="server" allowfilteringbycolumn="True" allowpaging="True" 
            allowsorting="True" autogeneratedeletecolumn="True" autogenerateeditcolumn="True" 
            datasourceid="LinqDataSource2" gridlines="None" showgrouppanel="True" skin="WebBlue">  
            <MasterTableView AutoGenerateColumns="False" DataKeyNames="FeedbackID" DataSourceID="LinqDataSource2" 
                CommandItemDisplay="Top" EditMode="PopUp">  
                <EditFormSettings PopUpSettings-Modal="true">  
                    <PopUpSettings Modal="True"></PopUpSettings> 
                </EditFormSettings> 
                <Columns> 
                <telerik:GridTemplateColumn DataField="Details" DataType="System.String" HeaderText="Feedback Details" 
                        SortExpression="Details" UniqueName="Details">  
                        <ItemTemplate> 
                            <%--Nothing here yet--%> 
                        </ItemTemplate> 
                        <EditItemTemplate> 
                            <telerik:RadWindow OnClientShow="SetDialogContent" OnClientPageLoad="SetDialogContent" 
                                NavigateUrl="EditorInWindow.aspx" runat="server" Behaviors="Maximize,Close,Move" 
                                ID="DialogWindow" VisibleStatusbar="false" Width="800px" Modal="true" Height="700px" />      
                                                          
                            <telerik:RadEditor ID="RadEditor1" EnableResize="false" runat="server" Width="460px" 
                                Height="200px">  
                                <Tools> 
                                    <telerik:EditorToolGroup> 
                                        <telerik:EditorTool Name="RichEditor" Text="Open Advanced Editor" /> 
                                    </telerik:EditorToolGroup> 
                                </Tools> 
                                <Content> 
                                   <img src="../../Img/productLogoLight.gif" alt="product logo" /> 
                                 <ul> 
                                        <li><em>Single-file, drag-and-drop deployment</em></li>  
                                        <li><em>Built on top of ASP.NET AJAX</em></li>  
                                    </ul> 
                                </Content> 
                            </telerik:RadEditor> 
                        </EditItemTemplate> 
                    </telerik:GridTemplateColumn> 
                </Columns> 
            </MasterTableView> 
            <ClientSettings AllowDragToGroup="True">  
            </ClientSettings> 
        </telerik:radgrid> 
 
        <script type="text/javascript">  
            //<![CDATA[
            var editorContent = null;
            Telerik.Web.UI.Editor.CommandList["RichEditor"] = function(commandName, editor, args) {
                editorContent = editor.get_html(true); //get RadEditor content
                $find("<%=DialogWindow.ClientID%>").show(); //open RadWindow
            };
            function SetEditorContent(content) {
                //set content to RadEditor on the mane page from RadWindow
                $find("<%=RadEditor1.ClientID%>").set_html(content);
            }
            function SetDialogContent(oWnd) {
                var contentWindow = oWnd.get_contentFrame().contentWindow;
                if (contentWindow && contentWindow.setContent) {
                    window.setTimeout(function() {
                        //pass and set the content from the mane page to RadEditor in RadWindow
                        contentWindow.setContent(editorContent);
                    }, 500);
                }
            }
            //]]> 
        </script> 

3 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 11 Feb 2010, 03:23 PM
Hi Dominick,

The following demo example will be very helpful for your scenario: Edit Dialog for RadGrid. You can combine the code of both articles (Edit Dialog for RadGrid and Editor in RadWindow) and implement the requested solution.

Kind regards,
Rumen
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.
0
Dominick DeStasio
Top achievements
Rank 1
answered on 11 Feb 2010, 04:48 PM
Thanks Rumen,

I did look at both of those examples but maybe I missed something...I will take a look again and get back to you.

Dominick
0
Dominick DeStasio
Top achievements
Rank 1
answered on 18 Mar 2010, 12:00 AM
Sorry for taking so long to get back to you but I got it to work. Thanks again.
Tags
Editor
Asked by
Dominick DeStasio
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Dominick DeStasio
Top achievements
Rank 1
Share this question
or