我正在將我的radGrid的數據源設置爲一個數據集(我存儲在會話中)。 我已啓用AllowAutomaticUpdates和EnableViewState,實現了NeedDataSource,設置DatakeyNames等(請參閱下面的代碼)Telerik radGrid - Datasource =數據集時可以使用AllowAutomaticUpdates嗎?
但是,當我按下Edit按鈕並進行更改並按Update鏈接時,記錄不會更新並離開編輯模式.....它只是停留在編輯模式,並沒有任何錯誤發生。
所以,問題是......有誰知道如果radGrid與EnableViewstate甚至支持AutomaticUpdates,那麼網格中的更改將自動推送到它所綁定的數據集中?
有人會認爲你可以閱讀文檔,但我一直無法找到明確的答案。
感謝
<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
在這個時候這已經很老了,但值得注意的是現在鏈接已經死了。 – Nol 2017-01-09 22:14:27