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

Delete button on InPlaceEdit grids

8 Answers 276 Views
Grid
This is a migrated thread and some comments may be shown as answers.
mqsash
Top achievements
Rank 1
mqsash asked on 13 Aug 2013, 09:24 AM
Hi

I have a RadGrid with EditMode="InPlace"
On this grid I need to display a "delete" button with standard delete functionality. For this I have added the following column markup :
   <telerik:GridButtonColumn
   ConfirmText="Delete this Invoice?"
   HeaderTooltip="Delete Invoice"
   Text="Delete"
   HeaderText="Delete"
   CommandName="Delete"
   UniqueName="DeleteCommandColumn"
   ConfirmTitle="Delete"
   ConfirmDialogType="RadWindow"
   ButtonType="ImageButton"
   HeaderStyle-Width="70px"
   HeaderStyle-HorizontalAlign="Center"
   ItemStyle-HorizontalAlign="Center"
   ItemStyle-CssClass="DeleteConfirmPopup">
</telerik:GridButtonColumn>

With this the column shows up on the grid but the image does not display on the rows.
Is this a limitation on the RadGrid's InPlaceEdit? How can I add the delete functionality for InPlaceEdit grids?

FWIW - the same markup works fine on grids with EditForms.

I found a few posts suggesting use of GridTemplateColumns with asp:Imagebutton, but since it was an old post I am hoping there is a better solution in v2013.2.611.45

Thanks

8 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 13 Aug 2013, 09:33 AM
Hi,

Can you make sure that you have not set AutoGenerateDeleteColumn="true" in the radgrid.Here is the code i tried and the delete icon is displayed.

ASPX:
<telerik:RadGrid ID="RadGrid1" runat="server"  OnDeleteCommand="RadGrid1_DeleteCommand">
    <MasterTableView EditMode="InPlace">  
        <Columns>         
            <telerik:GridButtonColumn ConfirmText="Delete this Invoice?" HeaderTooltip="Delete Invoice"  Text="Delete" HeaderText="Delete" CommandName="Delete" UniqueName="DeleteCommandColumn" ConfirmTitle="Delete" ConfirmDialogType="RadWindow" ButtonType="ImageButton">
            </telerik:GridButtonColumn>
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

Thanks,
Princy
0
mqsash
Top achievements
Rank 1
answered on 13 Aug 2013, 09:42 AM
Hi Princy,

The grid uses the following skin in which the AutoGenerateDeleteColumn is set to "false"


<telerk:RadGrid   
runat="server"
    SkinID="AlwaysEditableGrid"
    ShowStatusBar="True"
    EnableHeaderContextMenu="false"
    EnableHeaderContextAggregatesMenu="False"
    AutoGenerateColumns="False"
    AllowMultiRowEdit="True"
    AutoGenerateDeleteColumn="False"
    AutoGenerateEditColumn="False"
    AllowSorting="False"
    AllowPaging="False"
    CellSpacing="0"
    GridLines="None">
 
    <ExportSettings
      ExportOnlyData="True"
      Excel-Format="ExcelML"
      IgnorePaging="True"
      OpenInNewWindow="True"    
      HideStructureColumns="true">
    </ExportSettings>
 
    <MasterTableView
      EditMode="InPlace"
      ItemStyle-VerticalAlign="Top"     
      ExpandCollapseColumn-ButtonType="SpriteButton"
      AllowCustomSorting="False"
      CommandItemDisplay="Top"
      GridLines="None"
      Width="100%"
      FooterStyle-Font-Bold="true"
      ShowFooter="True">
          
         <CommandItemSettings
            ShowExportToPdfButton="true"
            ExportToPdfText="Export to PDF"
            ExportToExcelText="Export to Excel"
            ShowExportToExcelButton="true"
            ExportToWordText="Export to Word"
            ShowAddNewRecordButton="false"
            ShowExportToWordButton="true" />
 
    </MasterTableView>
 
    <ClientSettings
      AllowColumnsReorder="False"
      AllowDragToGroup="False"
      AllowColumnHide="false"
      AllowRowHide="false"
      AllowRowsDragDrop="false"
      AllowKeyboardNavigation="False"
      EnablePostBackOnRowClick="False"
      ReorderColumnsOnClient="True"
      Resizing-AllowColumnResize="true">
 
      <Selecting AllowRowSelect="True" />
      <Resizing AllowColumnResize="True" />
 
    </ClientSettings>
 
</telerik:RadGrid>


Thanks
mqs
0
mqsash
Top achievements
Rank 1
answered on 13 Aug 2013, 10:55 AM
I think I should also add that I have  AllowMultiRowEdit="True" along with the  editmode="InPlace"
This puts all rows in "InPlace" edit mode 

What I found was that if I took out the AllowMultiRowEdit = true and made selective rows editable then the delete image would display in the delete column for rows that are not in edit mode, but for the row being edited the button would not display.

Seems like you can't have a row in inplace edit mode and also display an Imagebutton in a GridButtonColumn at the same time!??
0
Kostadin
Telerik team
answered on 16 Aug 2013, 06:21 AM
Hi,

You are correct. When in-place edit mode is used and when a row is in edit mode the delete column image is hidden until you update/insert or cancel the operation. You could check out the following example where you could see the differences between in-form and in-line edit modes.

Regards,
Kostadin
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Max
Top achievements
Rank 1
answered on 30 Jul 2014, 09:19 AM
Hey everybody,

I am reopening this Thread as I have the same scenario but a different problem. I am working was a RadGrid in MultiRowEdit Mode and InPlace editing, too.
A delete functionality in editMode was added by using a GridTemplateColumn and Radbutton which calls a code behind delete function for the data source entry. This works fine for me. My only problem is that, as the row delete action is performed server side it is not shown instantly on the grid on postback (only when I reload on the page).

Can somebody help me with the problem ?

Thank you and best regards,

Max
0
Princy
Top achievements
Rank 2
answered on 30 Jul 2014, 09:55 AM
Hi Max,

I guess you are deleting records inside DeleteCommand , if so RadGrid will automatically refresh after delete if you binding the Grid in the NeedDataSource event. Make sure that you are using Advanced Data Binding.

Thanks,
Princy.
0
Max
Top achievements
Rank 1
answered on 30 Jul 2014, 09:59 AM
Hey Princy,

thank you for the fast answer. I am not deleting the Records inside DeleteCommand.
I fire a serverside click event of the RadButton:

<telerik:GridTemplateColumn>
    <ItemTemplate>
        <telerik:RadButton runat="server" ID="btnDeleteEntry" Text="Löschen" OnClick="btnDeleteEntry_Click"/>
    </ItemTemplate>
</telerik:GridTemplateColumn>

...

protected void btnDeleteEntry_Click(object sender, EventArgs e)
{
    RadButton currentButton = (RadButton)sender;
    GridDataItem row = (GridDataItem)currentButton.Parent.Parent;
    string ID = (string)row.GetDataKeyValue("ID");
 
    polyadmin.sql.polyadminSQL.DataAccess.sp_Execute("deleteLaenderRow", "ID", ID);
    gridFktLaender.MasterTableView.Rebind();
}

best regards,

Max

0
Max
Top achievements
Rank 1
answered on 30 Jul 2014, 12:46 PM
Dear Princy,

Thank you very much for the advice with advanced data binding!

It does not matter how I fire my delete (or any other row manipulation) event. If I leave the data binding strictly to the NeedDataSource event everything is working fine!

Thank you again.

Best regards,

Max
Tags
Grid
Asked by
mqsash
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
mqsash
Top achievements
Rank 1
Kostadin
Telerik team
Max
Top achievements
Rank 1
Share this question
or