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

Close Edit grid's popup after insert or update

12 Answers 778 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shane P
Top achievements
Rank 1
Shane P asked on 23 Nov 2008, 04:31 AM
Hi I am hoping for some help.

I have a grid with an editform popup (no usercontrol just edit form) after I do an update or insert I dont want to see the popup. How do I hide it?

I have tried 

grdItems.MasterTableView.ClearEditItems();

grdItems.MasterTableView.ClearChildEditItems();

grdItems.MasterTableView.ClearSelectedItems();

All of which don't work.


Can anyone help me out


Thank you!

12 Answers, 1 is accepted

Sort by
0
Kevin Babcock
Top achievements
Rank 1
answered on 24 Nov 2008, 03:58 AM
Hi Shane,

Are you saying that the popup edit form does not close after you insert or update a record? This should be the default behavior. Can you post some of your code so that I can see what is happening? Perhaps then I can help you further.

Regards,
Kevin Babcock
0
Ryan Moore
Top achievements
Rank 1
answered on 05 Jan 2009, 05:08 PM
I am experiencing an issue similar to the original poster.  When I use a PopUp edit form after submitting the popup form the RadGrid saves and updates correctly, but the RadWindow stays open.  I want the window to close when the form is completed.   The Cancel button closes, but the update/insert button does not.  Has an easy way to handle this been identified?

The button itself looks like this:

 <asp:Button ID="Button1"
                                        Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                        runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'
                                        CausesValidation="false" >
                                    </asp:Button>&nbsp;
                                    <asp:Button ID="Button2" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel">
                                    </asp:Button>


The start of the RadGrid (not complete code):

<telerik:RadGrid ID="RadGridActuals" Skin="WebBlue" runat="server" GridLines="Both"
            AllowPaging="false" AllowSorting="True" Width="99%" AutoGenerateColumns="False"
            ShowStatusBar="true" AllowAutomaticDeletes="True" AllowAutomaticInserts="True"
            AllowAutomaticUpdates="True" OnNeedDataSource="OnNeedDataSource" OnDeleteCommand="OnGridDeleteCommand"
            AutoGenerateEditColumn="true" OnUpdateCommand="OnGridUpdateCommand" OnInsertCommand="OnGridInsertCommand"
            OnDetailTableDataBind="OnGridExpand">

....

</telerik:RadGrid>
0
Princy
Top achievements
Rank 2
answered on 06 Jan 2009, 04:16 AM
Hello Ryan,

Are you perfroming the Update/insert operation manually or automatically? If you are performing the operation in code behind(manually), then set the AllowAutomaticInserts/Updates to false and check if it helps close the edit popup form.

Thanks
Princy.

0
Ryan Moore
Top achievements
Rank 1
answered on 06 Jan 2009, 03:39 PM
That seems to have done the trick.  Thank you very much.
0
Mydatafactory
Top achievements
Rank 1
answered on 08 Jan 2009, 01:45 PM
I have the same problem, however I use the Editform: In the grid I choose the option "add new" after which the Editform opens. After performing the operation (uploading file), which is performed manually in the code-behind, I click the 'insert' button. The file has been added, but the editform doesn't close.
The options AllowAutomaticUpdates, etc. are 'False'

0
Sebastian
Telerik team
answered on 08 Jan 2009, 01:59 PM
Hello A.,

This is indeed strange and unfortunately I cannot say for certain why the insert form remains open after a successful manual insert operation. Can you please double-check that the record is added in the grid source and you do not have e.Canceled = true somewhere in your InsertCommand handler?

You may also test whether settings explicitly e.Item.OwnerTableView.IsItemInserted = false from within the InsertCommand handler makes a difference.

Best regards,
Sebastian
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Mydatafactory
Top achievements
Rank 1
answered on 08 Jan 2009, 02:39 PM

Hi Sebastian,

What do you mean by ' that the record is added in the grid source'?

I do not have e.Canceled = true in my InsertCommand handler

When I add e.Item.OwnerTableView.IsItemInserted = false at the end in the InsertCommand I get the following error:

Insert item is available only when grid is in insert mode. 

Best regards,
Agnes
0
Sebastian
Telerik team
answered on 08 Jan 2009, 02:41 PM
Hello A.,

I meant to ensure that the inserted record is added to the underlying grid source.

Can you please post your grid definition along with the InsertCommand handler in this forum thread? I will inspect the code and will do my best to advice you further.

Regards,
Sebastian
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Mydatafactory
Top achievements
Rank 1
answered on 08 Jan 2009, 03:00 PM

Hi Sebastian,

The inserted record is added to the underlying grid source.

 

I have a hierchial grid with 3 levels. Detailtable with the name 'File' (line 176) is  the one I have problems with. 

 

    <telerik:RadGrid ID="gvProjects" runat="server" DataSourceID="dsProject" GridLines="None" 
        Skin="Office2007" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" 
        AllowMultiRowSelection="false" OnDetailTableDataBind="gvProjects_DetailTableDataBind" 
        OnNeedDataSource="gvProjects_NeedDataSource" DataKeyNames="ProjectId">  
        <PagerStyle Mode="NextPrevAndNumeric" /> 
        <ClientSettings EnablePostBackOnRowClick="true">  
            <Selecting AllowRowSelect="True"></Selecting> 
        </ClientSettings> 
        <MasterTableView CommandItemDisplay="Bottom" DataKeyNames="ProjectId" AllowPaging="True" 
            AutoGenerateColumns="False" Name="Projects" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" 
            AllowAutomaticUpdates="True" CommandItemSettings-AddNewRecordText="Add new project">  
            <%--Detailtable Tasks--%> 
            <DetailTables> 
                <telerik:GridTableView runat="server" DataKeyNames="ProjectId,TaskId" DataSourceID="dsTasks" 
                    CommandItemDisplay="Bottom" GridLines="None" Name="Tasks" PageSize="10" PagerStyle-Mode="NextPrevAndNumeric" 
                    AllowPaging="True" AutoGenerateColumns="False" Width="100%" ExpandCollapseColumn-ButtonType="ImageButton" 
                    AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" 
                    AllowSorting="True" NoDetailRecordsText="No tasks to display." EditFormSettings-ColumnNumber="3" 
                    CommandItemSettings-AddNewRecordText="Add new task" EditFormSettings-EditColumn-UpdateText="Update task" 
                    EditFormSettings-EditColumn-InsertText="Insert Task" EditFormSettings-EditColumn-CurrentFilterFunction="LessThanOrEqualTo">  
                    <%--Detailtable Files to Task--%> 
                    <DetailTables> 
                        <telerik:GridTableView runat="server" CommandItemDisplay="None" Name="FilesToTask" 
                            AllowPaging="True" PageSize="5" AutoGenerateColumns="False" Width="100%" DataSourceID="dsFilesToTask" 
                            DataKeyNames="TaskId, FileToTaskId" ClientDataKeyNames="FileId,FileSaveAs,FileName">  
                            <RowIndicatorColumn Visible="false">  
                                <HeaderStyle Width="20px"></HeaderStyle> 
                            </RowIndicatorColumn> 
                            <ExpandCollapseColumn Visible="true" Resizable="False">  
                                <HeaderStyle Width="20px"></HeaderStyle> 
                            </ExpandCollapseColumn> 
                            <ParentTableRelation> 
                                <telerik:GridRelationFields DetailKeyField="TaskId" MasterKeyField="TaskId" /> 
                            </ParentTableRelation> 
                            <%--Columns: Files attached to tasks--%> 
                            <Columns> 
                                <telerik:GridBoundColumn DataField="FileName" SortExpression="FileName" HeaderText="File" 
                                    UniqueName="FileName">  
                                </telerik:GridBoundColumn> 
                                <telerik:GridBoundColumn DataField="FileSaveAs" SortExpression="FileSaveAs" HeaderText="File ID" 
                                    UniqueName="FileSaveAs" Visible="False" ReadOnly="True">  
                                </telerik:GridBoundColumn> 
                                <telerik:GridBoundColumn DataField="FileId" SortExpression="FileId" HeaderText="File ID" 
                                    UniqueName="FileId" Visible="False" ReadOnly="True">  
                                </telerik:GridBoundColumn> 
                                <telerik:GridBoundColumn DataField="TaskId" SortExpression="TaskId" HeaderText="Task ID" 
                                    UniqueName="TaskId" Visible="False" ReadOnly="true">  
                                </telerik:GridBoundColumn> 
                                <telerik:GridDateTimeColumn DataField="DateCreated" SortExpression="DateCreated" 
                                    HeaderText="Date Created" UniqueName="DateCreated" Visible="False" PickerType="DatePicker" 
                                    DataFormatString="{0:d}">  
                                </telerik:GridDateTimeColumn> 
                                <telerik:GridBoundColumn SortExpression="FileToTaskId" HeaderText="FileToTaskId" 
                                    DataField="FileToTaskId" UniqueName="FileToTaskId" Visible="false" ReadOnly="True">  
                                </telerik:GridBoundColumn> 
                                <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandFileToTask">  
                                </telerik:GridEditCommandColumn> 
                                <telerik:GridButtonColumn ConfirmText="Delete this File?" ButtonType="ImageButton" 
                                    CommandName="Delete" Text="Delete" UniqueName="DeleteFileToTask">  
                                    <HeaderStyle Width="20px" /> 
                                </telerik:GridButtonColumn> 
                            </Columns> 
                            <EditFormSettings> 
                                <EditColumn ButtonType="ImageButton" InsertText="Insert File" UpdateText="Update File" 
                                    UniqueName="EditCommandColumn1" CancelText="Cancel Edit">  
                                </EditColumn> 
                                <FormTableButtonRowStyle HorizontalAlign="right" /> 
                                <PopUpSettings ScrollBars="None"></PopUpSettings> 
                            </EditFormSettings> 
                            <EditItemStyle BackColor="#00CC00" Font-Bold="False" Font-Italic="False" Font-Overline="False" 
                                Font-Strikeout="False" Font-Underline="False" ForeColor="#00CC00" Wrap="True" /> 
                        </telerik:GridTableView> 
                    </DetailTables> 
                    <RowIndicatorColumn Visible="False">  
                        <HeaderStyle Width="20px"></HeaderStyle> 
                    </RowIndicatorColumn> 
                    <ExpandCollapseColumn Resizable="False">  
                        <HeaderStyle Width="20px"></HeaderStyle> 
                    </ExpandCollapseColumn> 
                    <ParentTableRelation> 
                        <telerik:GridRelationFields DetailKeyField="ProjectId" MasterKeyField="ProjectId" /> 
                    </ParentTableRelation> 
                    <%--Columns Taken--%> 
                    <Columns> 
                        <telerik:GridBoundColumn DataField="TaskId" HeaderText="TaskId" ReadOnly="True" SortExpression="TaskId" 
                            UniqueName="TaskId" Visible="False">  
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="ProjectId" HeaderText="ProjectId" ReadOnly="True" 
                            SortExpression="ProjectId" UniqueName="ProjectId" Visible="false">  
                        </telerik:GridBoundColumn> 
                        <telerik:GridDropDownColumn DataField="BewerkingId" DataSourceID="dsTaskList" HeaderText="Task" 
                            ListTextField="SoortBewerking" ListValueField="BewerkingId" UniqueName="SoortBewerking" 
                            EditFormColumnIndex="0">  
                        </telerik:GridDropDownColumn> 
                        <telerik:GridBoundColumn DataField="TaskDescription" SortExpression="TaskDescription" 
                            HeaderText="Description" Visible="true" UniqueName="TaskDescription" EditFormColumnIndex="0">  
                        </telerik:GridBoundColumn> 
                          
                        <telerik:GridTemplateColumn UniqueName="TaskDescription" DataField="TaskDescription">  
                        <ItemTemplate> 
                                <asp:Label runat="server" ID="lblTaskDescription" Visible="true" Text='<%#Eval("TaskDescription") %>'></asp:Label> 
                        </ItemTemplate> 
                        <EditItemTemplate> 
                        <asp:Label runat="server" ID="lblTaskDescription" Visible="true" Text="Description"></asp:Label> 
                        <asp:TextBox runat="server" ID="txtTaskDescription" Visible="true" Text='<%#Bind("TaskDescription") %>'></asp:TextBox> 
                        <asp:RequiredFieldValidator ControlToValidate="txtTaskDescription" runat="server" ErrorMessage="Description">*</asp:RequiredFieldValidator> 
                        <asp:ValidationSummary ID="ValidationSummary1" runat="server" HeaderText="De volgende velden zijn verplicht:" 
            ShowMessageBox="True" ShowSummary="False" /> 
                        </EditItemTemplate> 
                          
                        </telerik:GridTemplateColumn> 
                          
                        <telerik:GridDropDownColumn DataField="UserId" DataSourceID="dsUsers" HeaderText="User" 
                            ListTextField="Name" ListValueField="UserId" UniqueName="UserId" EditFormColumnIndex="0">  
                        </telerik:GridDropDownColumn> 
                        <telerik:GridNumericColumn SortExpression="NumberArticles" DataField="NumberArticles" 
                            HeaderText="Number of Articles" UniqueName="NumberArticles" Visible="true" EditFormColumnIndex="0">  
                        </telerik:GridNumericColumn> 
                        <telerik:GridBoundColumn DataField="Remarks" HeaderText="Remarks" SortExpression="Remarks" 
                            UniqueName="Remarks" Visible="False" EditFormColumnIndex="0">  
                        </telerik:GridBoundColumn> 
                        <telerik:GridDropDownColumn DataField="StatusId" DataSourceID="dsStatus" HeaderText="Status" 
                            ListTextField="StatusNam" ListValueField="StatusId" UniqueName="ddlStatus" EditFormColumnIndex="0">  
                        </telerik:GridDropDownColumn> 
                        <telerik:GridDateTimeColumn DataField="DateSendDataSteward" SortExpression="DateSendDataSteward" 
                            HeaderText="Date Mail" PickerType="None" UniqueName="DateSendDataSteward" DataFormatString="{0:d}" 
                            EditFormColumnIndex="0">  
                        </telerik:GridDateTimeColumn> 
                        <telerik:GridDateTimeColumn DataField="StartDate" HeaderText="Start Date" SortExpression="StartDate" 
                            UniqueName="StartDate" PickerType="DatePicker" DataFormatString="{0:d}" EditFormColumnIndex="1" Visible="false">  
                        </telerik:GridDateTimeColumn> 
                        <telerik:GridNumericColumn SortExpression="EstimatedHours" DataField="EstimatedHours" 
                            HeaderText="Estimated Hours" UniqueName="EstimatedHours" Visible="true" EditFormColumnIndex="1">  
                        </telerik:GridNumericColumn> 
                        <telerik:GridDateTimeColumn SortExpression="EstimatedReadyDate" DataField="EstimatedReadyDate" 
                            UniqueName="EstimatedReadyDate" HeaderText="Estimated Date Finished" Visible="true" 
                            PickerType="DatePicker" DataFormatString="{0:d}" EditFormColumnIndex="1">  
                        </telerik:GridDateTimeColumn> 
                        <telerik:GridNumericColumn SortExpression="RealHours" DataField="RealHours" HeaderText="Real Hours" 
                            UniqueName="RealHours" Visible="false" EditFormColumnIndex="2">  
                        </telerik:GridNumericColumn> 
                        <telerik:GridDateTimeColumn DataField="ReadyDate" HeaderText="Ready Date" SortExpression="ReadyDate" 
                            UniqueName="ReadyDate" Visible="False" PickerType="DatePicker" EditFormColumnIndex="2">  
                        </telerik:GridDateTimeColumn> 
                        <telerik:GridDateTimeColumn DataField="Date" HeaderText="Date" UniqueName="Date" 
                            Visible="False" PickerType="DatePicker">  
                        </telerik:GridDateTimeColumn> 
                        <telerik:GridTemplateColumn UniqueName="TempCol" DataField="FileId">  
                            <ItemTemplate> 
                                <asp:Label runat="server" ID="lblFileId" Visible="false" Text='<%#Eval("TaskId") %>'></asp:Label> 
                            </ItemTemplate> 
                            <EditItemTemplate> 
                                <asp:Panel ID="mypanel" runat="server">  
                                    <asp:CheckBoxList ID="chkTasks" runat="server" DataTextField="FileName" DataValueField="FileId" 
                                        DataSourceID="dstest" AutoPostBack="True" RepeatDirection="Vertical" OnSelectedIndexChanged="chkTasks_CheckedChanged">  
                                    </asp:CheckBoxList> 
                                </asp:Panel> 
                            </EditItemTemplate> 
                            <ItemStyle HorizontalAlign="Left" VerticalAlign="Top" /> 
                        </telerik:GridTemplateColumn> 
                        <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandTask">  
                        </telerik:GridEditCommandColumn> 
                        <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" ConfirmDialogType="RadWindow" 
                            ConfirmText="Delete this task?" UniqueName="DeleteTask">  
                        </telerik:GridButtonColumn> 
                    </Columns> 
                    <EditFormSettings> 
                        <EditColumn ButtonType="ImageButton" InsertText="Insert Task" UpdateText="Update Task" 
                            UniqueName="EditCommandColumn1" CancelText="Candel Edit">  
                        </EditColumn> 
                        <PopUpSettings ScrollBars="None"></PopUpSettings> 
                        <FormTableButtonRowStyle HorizontalAlign="Right" /> 
                    </EditFormSettings> 
                    <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle> 
                </telerik:GridTableView> 
                <%-- Files attached to project--%> 
                <telerik:GridTableView runat="server" DataKeyNames="ProjectId, FileId" CommandItemDisplay="Bottom" 
                    Name="Files" PageSize="10" PagerStyle-Mode="NextPrevAndNumeric" AllowPaging="true" 
                    DataSourceID="dsFiles" AutoGenerateColumns="False" Width="100%" NoDetailRecordsText="No Files to display" 
                    CommandItemSettings-RefreshText="Refresh" CommandItemSettings-AddNewRecordText="Add new file" ClientDataKeyNames="FileId,FileSaveAs,FileName" AllowAutomaticDeletes="False" AllowAutomaticInserts="False" AllowAutomaticUpdates="False">  
                    <RowIndicatorColumn Visible="False">  
                        <HeaderStyle Width="20px"></HeaderStyle> 
                    </RowIndicatorColumn> 
                    <ExpandCollapseColumn Visible="True" Resizable="False">  
                        <HeaderStyle Width="20px"></HeaderStyle> 
                    </ExpandCollapseColumn> 
                    <ParentTableRelation> 
                        <telerik:GridRelationFields DetailKeyField="ProjectId" MasterKeyField="ProjectId" /> 
                    </ParentTableRelation> 
                    <%--Columns Files gekoppeld aan project--%> 
                    <Columns> 
                        <%--<telerik:GridBoundColumn DataField="FileName" HeaderText="FileName" SortExpression="FileName" 
                            UniqueName="FileName" Visible="true">  
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="FileSaveAs" HeaderText="FileSaveAs" SortExpression="FileSaveAs" 
                            UniqueName="FileSaveAs" Visible="False">  
                        </telerik:GridBoundColumn>--%> 
                        <telerik:GridTemplateColumn DataField="FileName" HeaderText="File" SortExpression="FileName" 
                            UniqueName="FileSaveAs1" Visible="true">  
                            <EditItemTemplate> 
                                <telerik:RadUpload ID="rupFile" runat="server" Skin="Office2007" /> 
                            </EditItemTemplate> 
                            <ItemTemplate> 
                                <asp:Label ID="lblFileDescription" runat="server" Text='<%#Eval("FileName") %>'></asp:Label> 
                            </ItemTemplate> 
                        </telerik:GridTemplateColumn> 
                        <%--<telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandFile" 
                            EditFormColumnIndex="2">  
                        </telerik:GridEditCommandColumn>--%> 
                        <telerik:GridButtonColumn ConfirmText="Delete this file?" ButtonType="ImageButton" 
                            CommandName="Delete" Text="Delete" UniqueName="DeleteFile">  
                            <HeaderStyle Width="20px" /> 
                        </telerik:GridButtonColumn> 
                        <telerik:GridTemplateColumn DataField="FileId" SortExpression="FileId" UniqueName="FileId" 
                            Visible="False">  
                        </telerik:GridTemplateColumn> 
                    </Columns> 
                    <EditFormSettings> 
                        <EditColumn ButtonType="ImageButton" InsertText="Insert File" UpdateText="Update File" 
                            UniqueName="EditCommandColumn1" CancelText="Candel Edit">  
                        </EditColumn> 
                        <PopUpSettings ScrollBars="None"></PopUpSettings> 
                        <FormTableButtonRowStyle HorizontalAlign="Right" /> 
                    </EditFormSettings> 
                    <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle> 
                </telerik:GridTableView> 
            </DetailTables> 
            <%--Columns Project--%> 
            <Columns> 
                <telerik:GridBoundColumn DataField="ProjectId" DataType="System.Int32" HeaderText="ProjectId" 
                    ReadOnly="True" SortExpression="ProjectId" UniqueName="ProjectId" Visible="false">  
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="ProjectName" HeaderText="ProjectName" SortExpression="ProjectName" 
                    UniqueName="ProjectName">  
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="ProjectDescription" HeaderText="ProjectDescription" 
                    SortExpression="ProjectDescription" UniqueName="ProjectDescription" Visible="False">  
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="Remarks" HeaderText="Remarks" SortExpression="Remarks" 
                    UniqueName="Remarks" Visible="False">  
                </telerik:GridBoundColumn> 
                <telerik:GridDropDownColumn DataField="CompanyId" DataSourceID="dsCompany" HeaderText="Company" 
                    ListTextField="CompanyName" ListValueField="CompanyId" UniqueName="Cust">  
                </telerik:GridDropDownColumn> 
                <telerik:GridNumericColumn DataField="ContractNummer" DataType="System.Int64" HeaderText="ContractNummer" 
                    SortExpression="ContractNummer" UniqueName="ContractNummer">  
                </telerik:GridNumericColumn> 
                <telerik:GridDropDownColumn DataField="DataSupplierId" DataSourceID="dsDataSup" HeaderText="Supplier" 
                    ListTextField="CompanyName" ListValueField="CompanyId" UniqueName="DataSup">  
                </telerik:GridDropDownColumn> 
                <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandProject">  
                    <HeaderStyle Width="20px" /> 
                </telerik:GridEditCommandColumn> 
                <telerik:GridButtonColumn ConfirmText="Delete this project?" ButtonType="ImageButton" 
                    CommandName="Delete" Text="Delete" UniqueName="DeleteProject">  
                    <HeaderStyle Width="20px" /> 
                </telerik:GridButtonColumn> 
            </Columns> 
            <RowIndicatorColumn Visible="False">  
                <HeaderStyle Width="20px"></HeaderStyle> 
            </RowIndicatorColumn> 
            <ExpandCollapseColumn Resizable="False">  
                <HeaderStyle Width="20px"></HeaderStyle> 
            </ExpandCollapseColumn> 
            <EditFormSettings> 
                <EditColumn ButtonType="ImageButton" InsertText="Insert" UpdateText="Update" UniqueName="EditCommandColumn1" 
                    CancelText="Candel Edit">  
                </EditColumn> 
                <FormTableButtonRowStyle HorizontalAlign="Right" /> 
                <PopUpSettings ScrollBars="None"></PopUpSettings> 
            </EditFormSettings> 
        </MasterTableView> 
    </telerik:RadGrid> 

This is the code-behind (it is part of '

 

Protected Sub gvProjects_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles gvProjects.ItemCommand')

 

 :
        If (e.CommandName = RadGrid.PerformInsertCommandName) Then  
            Dim parentItem = CType(e.Item.OwnerTableView.ParentItem, GridDataItem)  
 
            If (Not parentItem Is Nothing) Then  
                gvProjects.Controls.Add(New LiteralControl("Parent item primary field value is: " & _  
                CType(parentItem.OwnerTableView.DataKeyValues(parentItem.ItemIndex)("ProjectId"), String)))  
            End If  
            'Start insertFile  
            If (e.Item.OwnerTableView.DataSourceID = "dsFiles") Then  
                Dim uploader As RadUpload = e.Item.FindControl("rupFile")  
 
                If uploader.UploadedFiles.Count > 0 Then  
                    For Each ValidFile As UploadedFile In uploader.UploadedFiles  
                        Dim TargetFolder As String = System.Configuration.ConfigurationManager.AppSettings("UploadFolder").ToString  
                        Dim ProjectId As Integer = CType(parentItem.OwnerTableView.DataKeyValues(parentItem.ItemIndex)("ProjectId"), String)  
 
                        Dim FileExtension As String  
                        FileExtension = System.IO.Path.GetExtension(ValidFile.FileName).ToLower()  
                        Dim opslaanals As String  
                        opslaanals = Now().Year.ToString("0000")  
                        opslaanals += Now().Month.ToString("00")  
                        opslaanals += Now().Day.ToString("00")  
                        opslaanals += Now().TimeOfDay.TotalMilliseconds.ToString("00000000")  
 
                        Dim FileName As String = ValidFile.GetName  
                        If Not Directory.Exists(TargetFolder) Then  
                            Directory.CreateDirectory(TargetFolder)  
                        End If  
 
                        ValidFile.SaveAs(TargetFolder + opslaanals & FileExtension)  
                        'schrijft files weg naar database  
                        Dim datum As Date  
                        datum = Now()  
                        Dim strSQL As String = _ 
                                    "INSERT INTO tblFiles " & _  
                                    "(FileName, FileSaveAs, ProjectId, DownloadDate) " & _  
                                    "VALUES " & _  
                                    "(@FileName, @FileSaveAs, @ProjectId, @DownloadDate)"  
 
                        Dim Command As New SqlCommand(strSQL)  
                        Command.Parameters.Add(New SqlParameter("@FileName", SqlDbType.NVarChar)).Value = FileName 
                        Command.Parameters.Add(New SqlParameter("@FileSaveAs", SqlDbType.NVarChar)).Value = opslaanals & FileExtension  
                        Command.Parameters.Add(New SqlParameter("@ProjectId", SqlDbType.Int)).Value = ProjectId 
                        Command.Parameters.Add(New SqlParameter("@DownloadDate", SqlDbType.DateTime)).Value = datum 
 
                        DBPortal.Execute(Command)  
                    Next  
                    e.Item.OwnerTableView.IsItemInserted = False 
                End If  
 
            End If  
 
        End If 
0
Sebastian
Telerik team
answered on 12 Jan 2009, 11:27 AM
Hi A.,

Can you please verify that you are using the latest version 2008.3.1125 of RadControls for ASP.NET AJAX in your project? There was an issue with the inheritance of AllowAutomaticXXXX properties from the RadGrid instance in the detail tables which should be addressed in this version of the product and may cause the erroneous behavior in your case (i.e. the false settings for these properties to be disregarded for the detail table in question).

Alternatively, check whether settings the AllowAutomaticXXXX properties in the grid tag to false makes a difference.

Best regards,
Sebastian
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Steve Todd
Top achievements
Rank 1
answered on 12 Mar 2009, 11:49 AM
I've resolved this after many hours

set AllowAutomaticInserts="False" on the RadGrid AND on the MasterTableView of theRadGrid

Then use the item inserted method to reset the KeepInInsertMode

Protected Sub rgrdResources_ItemInserted(ByVal source As Object, ByVal e As Telerik.Web.UI.GridInsertedEventArgs) Handles rgrdResources.ItemInserted
   e.KeepInInsertMode = False
End Sub
0
mb
Top achievements
Rank 1
answered on 09 Aug 2010, 06:09 PM
Tags
Grid
Asked by
Shane P
Top achievements
Rank 1
Answers by
Kevin Babcock
Top achievements
Rank 1
Ryan Moore
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Mydatafactory
Top achievements
Rank 1
Sebastian
Telerik team
Steve Todd
Top achievements
Rank 1
mb
Top achievements
Rank 1
Share this question
or