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

Insert Button Confirm Dialog

3 Answers 155 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chase Florell
Top achievements
Rank 1
Chase Florell asked on 06 Dec 2008, 01:31 AM
I have the following RadGrid and I am Inserting new records inline.

                                <telerik:RadGrid AllowAutomaticInserts="false"   
                                                 OnInsertCommand="RadGrid1_ItemInserted" 
                                                 OnRowDrop="RadGrid1_RowDrop"   
                                                 OnNeedDataSource="RadGrid1_NeedDataSource"   
                                                 ID="RadGrid1"   
                                                 runat="server"   
                                                 AutoGenerateColumns="False"   
                                                 Skin="Telerik"   
                                                 AllowPaging="False"   
                                                 GridLines="None">  
                                    <MasterTableView TableLayout="Auto"   
                                                 DataKeyNames="ID"   
                                                 CommandItemDisplay="TopAndBottom">  
                                        <Columns> 
                                            <telerik:GridBoundColumn   
                                                 DataField="Category"   
                                                 HeaderText="Category"   
                                                 UniqueName="Category" /> 
                                        </Columns> 
                                    </MasterTableView> 
                                    <ClientSettings AllowRowsDragDrop="True">  
                                        <Selecting AllowRowSelect="True" /> 
                                    </ClientSettings> 
                                </telerik:RadGrid> 

My problem is that once the grid is in Insert Mode,  I need to create a Confirmation Dialog on the Insert Button that is generated by Telerik.  How do I find that control and add the javascript?

Thanks in advance.
Chase

3 Answers, 1 is accepted

Sort by
0
Chase Florell
Top achievements
Rank 1
answered on 06 Dec 2008, 01:56 AM
I also need to know how to set the width of the insert textbox.
0
Chase Florell
Top achievements
Rank 1
answered on 06 Dec 2008, 05:08 AM
Ok so I have changed my strategy a little bit but am still in need of help.

I like the look of InPlace insertion with an EditItemTemplate.  This way I should be able to dynamically add the Confirmation Dialog however I don't know how to fire a "Cancel" button to close the "Insert" row.  I can use OnClick="RadGrid1_ItemInsertedCanceled" but I don't know what to put in the handler.

Thoughs?

0
Chase Florell
Top achievements
Rank 1
answered on 06 Dec 2008, 05:47 AM
Wow this whole process took way longer than it should have.  I really gotta learn my RadControls better.  Here is the solution.

                                <telerik:RadGrid AllowAutomaticInserts="false"   
                                                 AllowAutomaticDeletes="false" 
                                                 AllowAutomaticUpdates="false" 
                                                 OnInsertCommand="RadGrid1_ItemInserted"   
                                                 OnRowDrop="RadGrid1_RowDrop"   
                                                 OnNeedDataSource="RadGrid1_NeedDataSource"   
                                                 ID="RadGrid1"   
                                                 runat="server"   
                                                 AutoGenerateColumns="False"   
                                                 Skin="Telerik"   
                                                 AllowPaging="False"   
                                                 GridLines="None">  
                                    <MasterTableView TableLayout="Auto"   
                                                 DataKeyNames="ID"   
                                                 CommandItemDisplay="Top" EditMode="InPlace">  
                                        <Columns> 
                                        <telerik:GridTemplateColumn> 
                                        <HeaderStyle Width="50" /> 
                                        <EditItemTemplate> 
                                            <asp:ImageButton OnClick="RadGrid1_ItemInserted"   
                                                             OnClientClick="javascript:return confirm('This category cannot be edited or deleted after\nit is submitted, please be sure to check your\nspelling before clicking OK.')"   
                                                             ID="InsertButton"   
                                                             runat="server"   
                                                             ImageUrl="~/Images/Icons/Symbol-Check.png" 
                                                             CssClass="HandCursor"   
                                                             AlternateText="Add New Category" />&nbsp;  
                                            <asp:ImageButton CommandName="Cancel"    
                                                             ID="CancelButton"   
                                                             runat="server" 
                                                             ImageUrl="~/Images/Icons/Symbol-Delete.png"   
                                                             CssClass="HandCursor"   
                                                             AlternateText="Cancel" /> 
                                            </EditItemTemplate> 
                                        </telerik:GridTemplateColumn> 
                                            <telerik:GridBoundColumn   
                                                 DataField="Category"   
                                                 HeaderText="Category"   
                                                 UniqueName="Category" /> 
                                        </Columns> 
                                    </MasterTableView> 
                                    <ClientSettings AllowRowsDragDrop="True">  
                                        <Selecting AllowRowSelect="True" /> 
                                    </ClientSettings> 
                                </telerik:RadGrid> 
Tags
Grid
Asked by
Chase Florell
Top achievements
Rank 1
Answers by
Chase Florell
Top achievements
Rank 1
Share this question
or