Close Edit grid's popup after insert or update

13 posts, 0 answers
  1. Shane P
    Shane P avatar
    86 posts
    Member since:
    Sep 2012

    Posted 22 Nov 2008 Link to this post

    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!

  2. Kevin Babcock
    Kevin Babcock avatar
    189 posts
    Member since:
    Mar 2007

    Posted 23 Nov 2008 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ryan Moore
    Ryan Moore avatar
    5 posts
    Member since:
    Nov 2008

    Posted 05 Jan 2009 Link to this post

    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>
  5. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 05 Jan 2009 Link to this post

    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.

  6. Ryan Moore
    Ryan Moore avatar
    5 posts
    Member since:
    Nov 2008

    Posted 06 Jan 2009 Link to this post

    That seems to have done the trick.  Thank you very much.
  7. Calago
    Calago avatar
    66 posts
    Member since:
    Feb 2008

    Posted 08 Jan 2009 Link to this post

    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'

  8. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 08 Jan 2009 Link to this post

    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.
  9. Calago
    Calago avatar
    66 posts
    Member since:
    Feb 2008

    Posted 08 Jan 2009 Link to this post

    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
  10. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 08 Jan 2009 Link to this post

    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.
  11. Calago
    Calago avatar
    66 posts
    Member since:
    Feb 2008

    Posted 08 Jan 2009 Link to this post

    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. 

     

    1     <telerik:RadGrid ID="gvProjects" runat="server" DataSourceID="dsProject" GridLines="None" 
    2         Skin="Office2007" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" 
    3         AllowMultiRowSelection="false" OnDetailTableDataBind="gvProjects_DetailTableDataBind" 
    4         OnNeedDataSource="gvProjects_NeedDataSource" DataKeyNames="ProjectId">  
    5         <PagerStyle Mode="NextPrevAndNumeric" /> 
    6         <ClientSettings EnablePostBackOnRowClick="true">  
    7             <Selecting AllowRowSelect="True"></Selecting> 
    8         </ClientSettings> 
    9         <MasterTableView CommandItemDisplay="Bottom" DataKeyNames="ProjectId" AllowPaging="True" 
    10             AutoGenerateColumns="False" Name="Projects" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" 
    11             AllowAutomaticUpdates="True" CommandItemSettings-AddNewRecordText="Add new project">  
    12             <%--Detailtable Tasks--%> 
    13             <DetailTables> 
    14                 <telerik:GridTableView runat="server" DataKeyNames="ProjectId,TaskId" DataSourceID="dsTasks" 
    15                     CommandItemDisplay="Bottom" GridLines="None" Name="Tasks" PageSize="10" PagerStyle-Mode="NextPrevAndNumeric" 
    16                     AllowPaging="True" AutoGenerateColumns="False" Width="100%" ExpandCollapseColumn-ButtonType="ImageButton" 
    17                     AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" 
    18                     AllowSorting="True" NoDetailRecordsText="No tasks to display." EditFormSettings-ColumnNumber="3" 
    19                     CommandItemSettings-AddNewRecordText="Add new task" EditFormSettings-EditColumn-UpdateText="Update task" 
    20                     EditFormSettings-EditColumn-InsertText="Insert Task" EditFormSettings-EditColumn-CurrentFilterFunction="LessThanOrEqualTo">  
    21                     <%--Detailtable Files to Task--%> 
    22                     <DetailTables> 
    23                         <telerik:GridTableView runat="server" CommandItemDisplay="None" Name="FilesToTask" 
    24                             AllowPaging="True" PageSize="5" AutoGenerateColumns="False" Width="100%" DataSourceID="dsFilesToTask" 
    25                             DataKeyNames="TaskId, FileToTaskId" ClientDataKeyNames="FileId,FileSaveAs,FileName">  
    26                             <RowIndicatorColumn Visible="false">  
    27                                 <HeaderStyle Width="20px"></HeaderStyle> 
    28                             </RowIndicatorColumn> 
    29                             <ExpandCollapseColumn Visible="true" Resizable="False">  
    30                                 <HeaderStyle Width="20px"></HeaderStyle> 
    31                             </ExpandCollapseColumn> 
    32                             <ParentTableRelation> 
    33                                 <telerik:GridRelationFields DetailKeyField="TaskId" MasterKeyField="TaskId" /> 
    34                             </ParentTableRelation> 
    35                             <%--Columns: Files attached to tasks--%> 
    36                             <Columns> 
    37                                 <telerik:GridBoundColumn DataField="FileName" SortExpression="FileName" HeaderText="File" 
    38                                     UniqueName="FileName">  
    39                                 </telerik:GridBoundColumn> 
    40                                 <telerik:GridBoundColumn DataField="FileSaveAs" SortExpression="FileSaveAs" HeaderText="File ID" 
    41                                     UniqueName="FileSaveAs" Visible="False" ReadOnly="True">  
    42                                 </telerik:GridBoundColumn> 
    43                                 <telerik:GridBoundColumn DataField="FileId" SortExpression="FileId" HeaderText="File ID" 
    44                                     UniqueName="FileId" Visible="False" ReadOnly="True">  
    45                                 </telerik:GridBoundColumn> 
    46                                 <telerik:GridBoundColumn DataField="TaskId" SortExpression="TaskId" HeaderText="Task ID" 
    47                                     UniqueName="TaskId" Visible="False" ReadOnly="true">  
    48                                 </telerik:GridBoundColumn> 
    49                                 <telerik:GridDateTimeColumn DataField="DateCreated" SortExpression="DateCreated" 
    50                                     HeaderText="Date Created" UniqueName="DateCreated" Visible="False" PickerType="DatePicker" 
    51                                     DataFormatString="{0:d}">  
    52                                 </telerik:GridDateTimeColumn> 
    53                                 <telerik:GridBoundColumn SortExpression="FileToTaskId" HeaderText="FileToTaskId" 
    54                                     DataField="FileToTaskId" UniqueName="FileToTaskId" Visible="false" ReadOnly="True">  
    55                                 </telerik:GridBoundColumn> 
    56                                 <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandFileToTask">  
    57                                 </telerik:GridEditCommandColumn> 
    58                                 <telerik:GridButtonColumn ConfirmText="Delete this File?" ButtonType="ImageButton" 
    59                                     CommandName="Delete" Text="Delete" UniqueName="DeleteFileToTask">  
    60                                     <HeaderStyle Width="20px" /> 
    61                                 </telerik:GridButtonColumn> 
    62                             </Columns> 
    63                             <EditFormSettings> 
    64                                 <EditColumn ButtonType="ImageButton" InsertText="Insert File" UpdateText="Update File" 
    65                                     UniqueName="EditCommandColumn1" CancelText="Cancel Edit">  
    66                                 </EditColumn> 
    67                                 <FormTableButtonRowStyle HorizontalAlign="right" /> 
    68                                 <PopUpSettings ScrollBars="None"></PopUpSettings> 
    69                             </EditFormSettings> 
    70                             <EditItemStyle BackColor="#00CC00" Font-Bold="False" Font-Italic="False" Font-Overline="False" 
    71                                 Font-Strikeout="False" Font-Underline="False" ForeColor="#00CC00" Wrap="True" /> 
    72                         </telerik:GridTableView> 
    73                     </DetailTables> 
    74                     <RowIndicatorColumn Visible="False">  
    75                         <HeaderStyle Width="20px"></HeaderStyle> 
    76                     </RowIndicatorColumn> 
    77                     <ExpandCollapseColumn Resizable="False">  
    78                         <HeaderStyle Width="20px"></HeaderStyle> 
    79                     </ExpandCollapseColumn> 
    80                     <ParentTableRelation> 
    81                         <telerik:GridRelationFields DetailKeyField="ProjectId" MasterKeyField="ProjectId" /> 
    82                     </ParentTableRelation> 
    83                     <%--Columns Taken--%> 
    84                     <Columns> 
    85                         <telerik:GridBoundColumn DataField="TaskId" HeaderText="TaskId" ReadOnly="True" SortExpression="TaskId" 
    86                             UniqueName="TaskId" Visible="False">  
    87                         </telerik:GridBoundColumn> 
    88                         <telerik:GridBoundColumn DataField="ProjectId" HeaderText="ProjectId" ReadOnly="True" 
    89                             SortExpression="ProjectId" UniqueName="ProjectId" Visible="false">  
    90                         </telerik:GridBoundColumn> 
    91                         <telerik:GridDropDownColumn DataField="BewerkingId" DataSourceID="dsTaskList" HeaderText="Task" 
    92                             ListTextField="SoortBewerking" ListValueField="BewerkingId" UniqueName="SoortBewerking" 
    93                             EditFormColumnIndex="0">  
    94                         </telerik:GridDropDownColumn> 
    95                         <telerik:GridBoundColumn DataField="TaskDescription" SortExpression="TaskDescription" 
    96                             HeaderText="Description" Visible="true" UniqueName="TaskDescription" EditFormColumnIndex="0">  
    97                         </telerik:GridBoundColumn> 
    98                           
    99                         <telerik:GridTemplateColumn UniqueName="TaskDescription" DataField="TaskDescription">  
    100                         <ItemTemplate> 
    101                                 <asp:Label runat="server" ID="lblTaskDescription" Visible="true" Text='<%#Eval("TaskDescription") %>'></asp:Label> 
    102                         </ItemTemplate> 
    103                         <EditItemTemplate> 
    104                         <asp:Label runat="server" ID="lblTaskDescription" Visible="true" Text="Description"></asp:Label> 
    105                         <asp:TextBox runat="server" ID="txtTaskDescription" Visible="true" Text='<%#Bind("TaskDescription") %>'></asp:TextBox> 
    106                         <asp:RequiredFieldValidator ControlToValidate="txtTaskDescription" runat="server" ErrorMessage="Description">*</asp:RequiredFieldValidator> 
    107                         <asp:ValidationSummary ID="ValidationSummary1" runat="server" HeaderText="De volgende velden zijn verplicht:" 
    108             ShowMessageBox="True" ShowSummary="False" /> 
    109                         </EditItemTemplate> 
    110                           
    111                         </telerik:GridTemplateColumn> 
    112                           
    113                         <telerik:GridDropDownColumn DataField="UserId" DataSourceID="dsUsers" HeaderText="User" 
    114                             ListTextField="Name" ListValueField="UserId" UniqueName="UserId" EditFormColumnIndex="0">  
    115                         </telerik:GridDropDownColumn> 
    116                         <telerik:GridNumericColumn SortExpression="NumberArticles" DataField="NumberArticles" 
    117                             HeaderText="Number of Articles" UniqueName="NumberArticles" Visible="true" EditFormColumnIndex="0">  
    118                         </telerik:GridNumericColumn> 
    119                         <telerik:GridBoundColumn DataField="Remarks" HeaderText="Remarks" SortExpression="Remarks" 
    120                             UniqueName="Remarks" Visible="False" EditFormColumnIndex="0">  
    121                         </telerik:GridBoundColumn> 
    122                         <telerik:GridDropDownColumn DataField="StatusId" DataSourceID="dsStatus" HeaderText="Status" 
    123                             ListTextField="StatusNam" ListValueField="StatusId" UniqueName="ddlStatus" EditFormColumnIndex="0">  
    124                         </telerik:GridDropDownColumn> 
    125                         <telerik:GridDateTimeColumn DataField="DateSendDataSteward" SortExpression="DateSendDataSteward" 
    126                             HeaderText="Date Mail" PickerType="None" UniqueName="DateSendDataSteward" DataFormatString="{0:d}" 
    127                             EditFormColumnIndex="0">  
    128                         </telerik:GridDateTimeColumn> 
    129                         <telerik:GridDateTimeColumn DataField="StartDate" HeaderText="Start Date" SortExpression="StartDate" 
    130                             UniqueName="StartDate" PickerType="DatePicker" DataFormatString="{0:d}" EditFormColumnIndex="1" Visible="false">  
    131                         </telerik:GridDateTimeColumn> 
    132                         <telerik:GridNumericColumn SortExpression="EstimatedHours" DataField="EstimatedHours" 
    133                             HeaderText="Estimated Hours" UniqueName="EstimatedHours" Visible="true" EditFormColumnIndex="1">  
    134                         </telerik:GridNumericColumn> 
    135                         <telerik:GridDateTimeColumn SortExpression="EstimatedReadyDate" DataField="EstimatedReadyDate" 
    136                             UniqueName="EstimatedReadyDate" HeaderText="Estimated Date Finished" Visible="true" 
    137                             PickerType="DatePicker" DataFormatString="{0:d}" EditFormColumnIndex="1">  
    138                         </telerik:GridDateTimeColumn> 
    139                         <telerik:GridNumericColumn SortExpression="RealHours" DataField="RealHours" HeaderText="Real Hours" 
    140                             UniqueName="RealHours" Visible="false" EditFormColumnIndex="2">  
    141                         </telerik:GridNumericColumn> 
    142                         <telerik:GridDateTimeColumn DataField="ReadyDate" HeaderText="Ready Date" SortExpression="ReadyDate" 
    143                             UniqueName="ReadyDate" Visible="False" PickerType="DatePicker" EditFormColumnIndex="2">  
    144                         </telerik:GridDateTimeColumn> 
    145                         <telerik:GridDateTimeColumn DataField="Date" HeaderText="Date" UniqueName="Date" 
    146                             Visible="False" PickerType="DatePicker">  
    147                         </telerik:GridDateTimeColumn> 
    148                         <telerik:GridTemplateColumn UniqueName="TempCol" DataField="FileId">  
    149                             <ItemTemplate> 
    150                                 <asp:Label runat="server" ID="lblFileId" Visible="false" Text='<%#Eval("TaskId") %>'></asp:Label> 
    151                             </ItemTemplate> 
    152                             <EditItemTemplate> 
    153                                 <asp:Panel ID="mypanel" runat="server">  
    154                                     <asp:CheckBoxList ID="chkTasks" runat="server" DataTextField="FileName" DataValueField="FileId" 
    155                                         DataSourceID="dstest" AutoPostBack="True" RepeatDirection="Vertical" OnSelectedIndexChanged="chkTasks_CheckedChanged">  
    156                                     </asp:CheckBoxList> 
    157                                 </asp:Panel> 
    158                             </EditItemTemplate> 
    159                             <ItemStyle HorizontalAlign="Left" VerticalAlign="Top" /> 
    160                         </telerik:GridTemplateColumn> 
    161                         <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandTask">  
    162                         </telerik:GridEditCommandColumn> 
    163                         <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" ConfirmDialogType="RadWindow" 
    164                             ConfirmText="Delete this task?" UniqueName="DeleteTask">  
    165                         </telerik:GridButtonColumn> 
    166                     </Columns> 
    167                     <EditFormSettings> 
    168                         <EditColumn ButtonType="ImageButton" InsertText="Insert Task" UpdateText="Update Task" 
    169                             UniqueName="EditCommandColumn1" CancelText="Candel Edit">  
    170                         </EditColumn> 
    171                         <PopUpSettings ScrollBars="None"></PopUpSettings> 
    172                         <FormTableButtonRowStyle HorizontalAlign="Right" /> 
    173                     </EditFormSettings> 
    174                     <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle> 
    175                 </telerik:GridTableView> 
    176                 <%-- Files attached to project--%> 
    177                 <telerik:GridTableView runat="server" DataKeyNames="ProjectId, FileId" CommandItemDisplay="Bottom" 
    178                     Name="Files" PageSize="10" PagerStyle-Mode="NextPrevAndNumeric" AllowPaging="true" 
    179                     DataSourceID="dsFiles" AutoGenerateColumns="False" Width="100%" NoDetailRecordsText="No Files to display" 
    180                     CommandItemSettings-RefreshText="Refresh" CommandItemSettings-AddNewRecordText="Add new file" ClientDataKeyNames="FileId,FileSaveAs,FileName" AllowAutomaticDeletes="False" AllowAutomaticInserts="False" AllowAutomaticUpdates="False">  
    181                     <RowIndicatorColumn Visible="False">  
    182                         <HeaderStyle Width="20px"></HeaderStyle> 
    183                     </RowIndicatorColumn> 
    184                     <ExpandCollapseColumn Visible="True" Resizable="False">  
    185                         <HeaderStyle Width="20px"></HeaderStyle> 
    186                     </ExpandCollapseColumn> 
    187                     <ParentTableRelation> 
    188                         <telerik:GridRelationFields DetailKeyField="ProjectId" MasterKeyField="ProjectId" /> 
    189                     </ParentTableRelation> 
    190                     <%--Columns Files gekoppeld aan project--%> 
    191                     <Columns> 
    192                         <%--<telerik:GridBoundColumn DataField="FileName" HeaderText="FileName" SortExpression="FileName" 
    193                             UniqueName="FileName" Visible="true">  
    194                         </telerik:GridBoundColumn> 
    195                         <telerik:GridBoundColumn DataField="FileSaveAs" HeaderText="FileSaveAs" SortExpression="FileSaveAs" 
    196                             UniqueName="FileSaveAs" Visible="False">  
    197                         </telerik:GridBoundColumn>--%> 
    198                         <telerik:GridTemplateColumn DataField="FileName" HeaderText="File" SortExpression="FileName" 
    199                             UniqueName="FileSaveAs1" Visible="true">  
    200                             <EditItemTemplate> 
    201                                 <telerik:RadUpload ID="rupFile" runat="server" Skin="Office2007" /> 
    202                             </EditItemTemplate> 
    203                             <ItemTemplate> 
    204                                 <asp:Label ID="lblFileDescription" runat="server" Text='<%#Eval("FileName") %>'></asp:Label> 
    205                             </ItemTemplate> 
    206                         </telerik:GridTemplateColumn> 
    207                         <%--<telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandFile" 
    208                             EditFormColumnIndex="2">  
    209                         </telerik:GridEditCommandColumn>--%> 
    210                         <telerik:GridButtonColumn ConfirmText="Delete this file?" ButtonType="ImageButton" 
    211                             CommandName="Delete" Text="Delete" UniqueName="DeleteFile">  
    212                             <HeaderStyle Width="20px" /> 
    213                         </telerik:GridButtonColumn> 
    214                         <telerik:GridTemplateColumn DataField="FileId" SortExpression="FileId" UniqueName="FileId" 
    215                             Visible="False">  
    216                         </telerik:GridTemplateColumn> 
    217                     </Columns> 
    218                     <EditFormSettings> 
    219                         <EditColumn ButtonType="ImageButton" InsertText="Insert File" UpdateText="Update File" 
    220                             UniqueName="EditCommandColumn1" CancelText="Candel Edit">  
    221                         </EditColumn> 
    222                         <PopUpSettings ScrollBars="None"></PopUpSettings> 
    223                         <FormTableButtonRowStyle HorizontalAlign="Right" /> 
    224                     </EditFormSettings> 
    225                     <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle> 
    226                 </telerik:GridTableView> 
    227             </DetailTables> 
    228             <%--Columns Project--%> 
    229             <Columns> 
    230                 <telerik:GridBoundColumn DataField="ProjectId" DataType="System.Int32" HeaderText="ProjectId" 
    231                     ReadOnly="True" SortExpression="ProjectId" UniqueName="ProjectId" Visible="false">  
    232                 </telerik:GridBoundColumn> 
    233                 <telerik:GridBoundColumn DataField="ProjectName" HeaderText="ProjectName" SortExpression="ProjectName" 
    234                     UniqueName="ProjectName">  
    235                 </telerik:GridBoundColumn> 
    236                 <telerik:GridBoundColumn DataField="ProjectDescription" HeaderText="ProjectDescription" 
    237                     SortExpression="ProjectDescription" UniqueName="ProjectDescription" Visible="False">  
    238                 </telerik:GridBoundColumn> 
    239                 <telerik:GridBoundColumn DataField="Remarks" HeaderText="Remarks" SortExpression="Remarks" 
    240                     UniqueName="Remarks" Visible="False">  
    241                 </telerik:GridBoundColumn> 
    242                 <telerik:GridDropDownColumn DataField="CompanyId" DataSourceID="dsCompany" HeaderText="Company" 
    243                     ListTextField="CompanyName" ListValueField="CompanyId" UniqueName="Cust">  
    244                 </telerik:GridDropDownColumn> 
    245                 <telerik:GridNumericColumn DataField="ContractNummer" DataType="System.Int64" HeaderText="ContractNummer" 
    246                     SortExpression="ContractNummer" UniqueName="ContractNummer">  
    247                 </telerik:GridNumericColumn> 
    248                 <telerik:GridDropDownColumn DataField="DataSupplierId" DataSourceID="dsDataSup" HeaderText="Supplier" 
    249                     ListTextField="CompanyName" ListValueField="CompanyId" UniqueName="DataSup">  
    250                 </telerik:GridDropDownColumn> 
    251                 <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandProject">  
    252                     <HeaderStyle Width="20px" /> 
    253                 </telerik:GridEditCommandColumn> 
    254                 <telerik:GridButtonColumn ConfirmText="Delete this project?" ButtonType="ImageButton" 
    255                     CommandName="Delete" Text="Delete" UniqueName="DeleteProject">  
    256                     <HeaderStyle Width="20px" /> 
    257                 </telerik:GridButtonColumn> 
    258             </Columns> 
    259             <RowIndicatorColumn Visible="False">  
    260                 <HeaderStyle Width="20px"></HeaderStyle> 
    261             </RowIndicatorColumn> 
    262             <ExpandCollapseColumn Resizable="False">  
    263                 <HeaderStyle Width="20px"></HeaderStyle> 
    264             </ExpandCollapseColumn> 
    265             <EditFormSettings> 
    266                 <EditColumn ButtonType="ImageButton" InsertText="Insert" UpdateText="Update" UniqueName="EditCommandColumn1" 
    267                     CancelText="Candel Edit">  
    268                 </EditColumn> 
    269                 <FormTableButtonRowStyle HorizontalAlign="Right" /> 
    270                 <PopUpSettings ScrollBars="None"></PopUpSettings> 
    271             </EditFormSettings> 
    272         </MasterTableView> 
    273     </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')

     

     :
    1         If (e.CommandName = RadGrid.PerformInsertCommandName) Then  
    2             Dim parentItem = CType(e.Item.OwnerTableView.ParentItem, GridDataItem)  
    3  
    4             If (Not parentItem Is Nothing) Then  
    5                 gvProjects.Controls.Add(New LiteralControl("Parent item primary field value is: " & _  
    6                 CType(parentItem.OwnerTableView.DataKeyValues(parentItem.ItemIndex)("ProjectId"), String)))  
    7             End If  
    8             'Start insertFile  
    9             If (e.Item.OwnerTableView.DataSourceID = "dsFiles") Then  
    10                 Dim uploader As RadUpload = e.Item.FindControl("rupFile")  
    11  
    12                 If uploader.UploadedFiles.Count > 0 Then  
    13                     For Each ValidFile As UploadedFile In uploader.UploadedFiles  
    14                         Dim TargetFolder As String = System.Configuration.ConfigurationManager.AppSettings("UploadFolder").ToString  
    15                         Dim ProjectId As Integer = CType(parentItem.OwnerTableView.DataKeyValues(parentItem.ItemIndex)("ProjectId"), String)  
    16  
    17                         Dim FileExtension As String  
    18                         FileExtension = System.IO.Path.GetExtension(ValidFile.FileName).ToLower()  
    19                         Dim opslaanals As String  
    20                         opslaanals = Now().Year.ToString("0000")  
    21                         opslaanals += Now().Month.ToString("00")  
    22                         opslaanals += Now().Day.ToString("00")  
    23                         opslaanals += Now().TimeOfDay.TotalMilliseconds.ToString("00000000")  
    24  
    25                         Dim FileName As String = ValidFile.GetName  
    26                         If Not Directory.Exists(TargetFolder) Then  
    27                             Directory.CreateDirectory(TargetFolder)  
    28                         End If  
    29  
    30                         ValidFile.SaveAs(TargetFolder + opslaanals & FileExtension)  
    31                         'schrijft files weg naar database  
    32                         Dim datum As Date  
    33                         datum = Now()  
    34                         Dim strSQL As String = _ 
    35                                     "INSERT INTO tblFiles " & _  
    36                                     "(FileName, FileSaveAs, ProjectId, DownloadDate) " & _  
    37                                     "VALUES " & _  
    38                                     "(@FileName, @FileSaveAs, @ProjectId, @DownloadDate)"  
    39  
    40                         Dim Command As New SqlCommand(strSQL)  
    41                         Command.Parameters.Add(New SqlParameter("@FileName", SqlDbType.NVarChar)).Value = FileName 
    42                         Command.Parameters.Add(New SqlParameter("@FileSaveAs", SqlDbType.NVarChar)).Value = opslaanals & FileExtension  
    43                         Command.Parameters.Add(New SqlParameter("@ProjectId", SqlDbType.Int)).Value = ProjectId 
    44                         Command.Parameters.Add(New SqlParameter("@DownloadDate", SqlDbType.DateTime)).Value = datum 
    45  
    46                         DBPortal.Execute(Command)  
    47                     Next  
    48                     e.Item.OwnerTableView.IsItemInserted = False 
    49                 End If  
    50  
    51             End If  
    52  
    53         End If 
  12. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 12 Jan 2009 Link to this post

    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.
  13. Steve Todd
    Steve Todd avatar
    31 posts
    Member since:
    Dec 2005

    Posted 12 Mar 2009 Link to this post

    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
  14. mb
    mb avatar
    1 posts
    Member since:
    Aug 2010

    Posted 09 Aug 2010 Link to this post

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017