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

[Solved] AutoGenerate Delete Column

0 Answers 301 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Muhammad
Top achievements
Rank 1
Muhammad asked on 30 Jul 2013, 04:33 PM
Hi All,

I am using RadGrid AutoGenerateDeleteColumn.

Is there any possibility to add a confirmation message before deleting anything from the database. I would like to add a confirmation message from code behind. I have also tried the find the column on columnCreated event but I didn't find that column name. I am setting the autogeneratedeletecolumn = true property on Page_Load event.

Many thanks for your advance responses.


Thanks everyone to read this post. I have found the answer.

<telerik:RadGrid ID="rgList" Width="100%" AllowFilteringByColumn="true" Skin="Metro"
       AutoGenerateDeleteColumn="false" AutoGenerateEditColumn="false" EnableEmbeddedBaseStylesheet="true"
       AllowSorting="True" AllowPaging="True" PageSize="10" ShowHeader="true" runat="server"
       AutoGenerateColumns="true" ShowStatusBar="true">
       <MasterTableView TableLayout="Auto" CommandItemDisplay="Top">
           <CommandItemSettings ShowRefreshButton="false" ShowAddNewRecordButton="false" ShowExportToCsvButton="true"
               ShowExportToExcelButton="true" />         
       </MasterTableView>
       <GroupingSettings CaseSensitive="false" />
       <ClientSettings>
           <Selecting AllowRowSelect="true" />
       </ClientSettings>
   </telerik:RadGrid>

 Protected Sub rgList_ColumnCreated(ByVal sender As Object, ByVal e As GridColumnCreatedEventArgs) Handles rgList.ColumnCreated

        For Each col As GridColumn In rgList.MasterTableView.AutoGeneratedColumns
            If col.UniqueName = Constants.EDIT Then
                TryCast(col, GridBoundColumn).AllowFiltering = False
                TryCast(col, GridBoundColumn).HeaderText = ""
            ElseIf col.UniqueName = Constants.DELETE Then 'hiding Delete column from database
                col.Visible = False
            ElseIf col.UniqueName = "AutoGeneratedDeleteColumn" Then
                Dim gridButtonColumn As GridButtonColumn = col
                gridButtonColumn.ConfirmText = Constants.DELETE_CONFIRM_MESSAGE
            Else
                col.AutoPostBackOnFilter = True
                col.CurrentFilterFunction = GridKnownFunction.Contains
            End If
        Next

    End Sub


No answers yet. Maybe you can help?

Tags
Grid
Asked by
Muhammad
Top achievements
Rank 1
Share this question
or