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

[Solved] Popup Edit form not closing

2 Answers 371 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Neil Mercer
Top achievements
Rank 1
Neil Mercer asked on 11 Nov 2009, 05:36 AM
Hi,

I've created a simple Grid, and set it to use the popup edit mode (I've just copied directly from the samples).

I've also created my own code for the Update and Insert commands - again largely copied from the samples.

When invoking the popup to edit an existing row, after clicking the Update button my code fires, and the data is updated however the Popup form doesn't close automatically. 

However, when invoking the popup to add a new row it works perfectly and the popup closes.

Here's the code for my grid:

<telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True"   
    AllowPaging="True" AllowSorting="True" GridLines="None" Skin="Sitefinity"   
    AutoGenerateColumns="False" AllowAutomaticUpdates="True" AutoGenerateEditColumn="true" > 
 
<MasterTableView EditMode="PopUp" CommandItemDisplay="Top" DataKeyNames="ItemCode" > 
            <EditFormSettings InsertCaption="Add new item" CaptionFormatString="Edit Item: {0}" 
                CaptionDataField="ItemCode" PopUpSettings-Modal="true" EditFormType="Template" > 
<EditColumn UniqueName="EditCommandColumn1"></EditColumn> 
                <FormTemplate> 
                    <table id="Table1" cellspacing="1" cellpadding="1" width="80%" border="0">  
                        <tr> 
                            <td> 
                            </td> 
                            <td> 
                            </td> 
                        </tr> 
                        <tr> 
                            <td> 
                                Branch:  
                            </td> 
                            <td> 
                                <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind( "Branch" ) %>'>  
                                </asp:TextBox> 
                            </td> 
                        </tr> 
                        <tr> 
                            <td> 
                                Item Code:  
                            </td> 
                            <td> 
                                <asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind( "ItemCode") %>' TabIndex="1">  
                                </asp:TextBox> 
                            </td> 
                        </tr> 
                        <tr> 
                            <td> 
                                Description:  
                            </td> 
                            <td> 
                                <asp:TextBox ID="TextBox6" runat="server" Text='<%# Bind( "ItemDescription") %>' TabIndex="2">  
                                </asp:TextBox> 
                            </td> 
                        </tr> 
                    </table> 
                    <table style="width: 100%">  
                        <tr> 
                            <td align="right" colspan="2">  
                                <asp:Button ID="Button1" Text='<%# Iif (TypeOf Container is GridEditFormInsertItem, "Insert", "Update") %>' 
                                    runat="server" CommandName='<%# Iif (TypeOf Container is GridEditFormInsertItem, "PerformInsert", "Update") %>'>  
                                </asp:Button>&nbsp;  
                                <asp:Button ID="Button2" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel">  
                                </asp:Button> 
                            </td> 
                        </tr> 
                    </table> 
                </FormTemplate> 
 
<PopUpSettings Modal="True"></PopUpSettings> 
</EditFormSettings> 
    <Columns> 
 
        <telerik:GridBoundColumn DataField="Branch2.BranchName" HeaderText="Branch"   
            UniqueName="column1">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="ItemCode" HeaderText="Item"   
            UniqueName="column3">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="ItemDescription"   
            HeaderText="Item Description" UniqueName="column2">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="Status2.StatusName" HeaderText="Status"   
            UniqueName="column">  
        </telerik:GridBoundColumn> 
    </Columns> 
</MasterTableView> 
        <ClientSettings> 
            <ClientEvents OnRowDblClick="RowDblClick" /> 
        </ClientSettings> 
        </telerik:RadGrid> 


Any suggestions?

Thanks,
Neil.

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 11 Nov 2009, 07:32 AM
Hello Neil,

Try setting the AllowAutomaticUpdates property of your grid to False since you are manually updating your grid. This should help close the editform pop up once the grid is updated.

Thanks
Princy.
0
Neil Mercer
Top achievements
Rank 1
answered on 11 Nov 2009, 09:09 PM
Hi Princy,

That did the trick.  I must have set it to true when playing around earlier, and then didn't even notice it.

Thanks for your help,
Neil.
Tags
Grid
Asked by
Neil Mercer
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Neil Mercer
Top achievements
Rank 1
Share this question
or