Telerik radGrid - can AllowAutomaticUpdates be used when Datasource = dataset?

I set the data source of my radGrid to a dataset (which I saved in the session). I turned on AllowAutomaticUpdates and EnableViewState, implemented NeedDataSource, installed DatakeyNames, etc. (See code below)

However, when I click the โ€œChangeโ€ button and make changes and click the โ€œRefreshโ€ link, the record does not update and does not exit the editing mode ... it just remains in the editing mode and no error occurs.

So the question is ... does anyone know if radGrid with EnableViewstate can even support AutomaticUpdates, so changes to the grid will automatically be inserted into the dataset to which it is bound?

You might think that you can read the documentation, but I could not find the final answer.

thanks


<telerik:Radgrid id="grid" runat="server" AllowPaging="True" AllowSorting="True" AllowAutomaticUpdates="true" 
            AutoGenerateEditColumn="True" GridLines="None" >

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            Dim data As New DataGateway
            Dim ds As DataSet = data.GetEmployeesByProgram(Year:=2009, ProgramName:="Long Term Incentive Stock Program")
            Dim dt As DataTable = ds.Tables(0)
            ds.Tables(0).PrimaryKey = New DataColumn() {dt.Columns("EmployeeNum"), dt.Columns("ProgramName"), dt.Columns("Year")}
            Session("datasource") = ds
            With Me.grid
                .AllowAutomaticUpdates = True
                .AutoGenerateColumns = True
                .AllowSorting = True
                .AutoGenerateEditColumn = True
                .EnableViewState = True     'IS REQUIRED!!!
                Me.grid.MasterTableView.AllowAutomaticUpdates = True
                Me.grid.MasterTableView.EditMode = GridEditMode.InPlace
            End With
        End If
    End Sub




Private Sub grid_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles grid.NeedDataSource
        Debug.WriteLine("NeedDataSource: " & e.RebindReason.ToString)
        Dim ds As DataSet = CType(Session("datasource"), DataSet)
        Me.grid.MasterTableView.DataKeyNames = New String() {"EmployeeNum", "ProgramName", "Year"}
        Me.grid.DataSource = ds

    End Sub
+3
source share
2 answers

In short, there is one key problem:

"Automatic" operations are only supported when using the data source control to snap the grid. This includes an ObjectDataSource, so you can use your DAL with ODS and then support automatic updates / updates / deletes.

. , , RadGrid, "" CRUD. , , , . Telerik.com :

http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/editmodes/defaultcs.aspx

RadGrid ViewState, . - Grid ( , DAL ). :

http://demos.telerik.com/aspnet-ajax/grid/examples/client/insertupdatedelete/defaultcs.aspx

, ! -Todd

+7

Source: https://habr.com/ru/post/1702372/


All Articles