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

Column Chooser with postback

1 Answer 51 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Jocelyn asked on 28 Nov 2012, 07:17 PM

I use your GridSettingsPersister.vb and save those settings in a DataBase. I don't save the settings using a "Save settings button" I do it in the Grid PreRender event on a PostBack:

Public Sub tmpGrid_PreRender(ByVal sender As Object, ByVal e As System.EventArgs)
    Dim tmpGrid As RadGrid = sender
    Dim settingsType As GridSettingsType = GridSettingsType.ColumnSettings Or _
                                            GridSettingsType.Grouping Or _
                                            GridSettingsType.Paging Or _
    Dim persister As New GridSettingsPersister(tmpGrid, settingsType)
    If tmpGrid.Page.IsPostBack Then
        Dim param As String = persister.SaveSettings()
        Dim SQLGrille As LWebStatement = ExecuteSql("Select UCPR_NOAUTO, PARAM from USAGERCOLONNEPRESCRIPTEUR " & _
                                      " WHERE NOAUTOUSAGER = " & CurrentUser.NoCurrentUser & _
                                              " AND NOMPAGE = '" & tmpGrid.Page.ToString & "' " & _
                                              " AND NOMGRILLE = '" & tmpGrid.ID & "'")
        If SQLGrille.HasRecord Then
        End If
    End If
End Sub

It works like a charm except for the Column chooser because it is client side. How can I force a PostBack when the user Show/Hide a column?


1 Answer, 1 is accepted

Sort by
Telerik team
answered on 03 Dec 2012, 10:13 AM

 If you are using the header context menu of the grid the show / hide operation there works only on the client. If you need to perform a postback you will need to customize the header context menu as shown in the help topic by adding new custom items that fire a custom command from the client using the fireCommand method of the grid which can be handled on the server side and there you can show or hide the column and preserve the setting.

the Telerik team
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 their blog feed now.
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question