Jun 06, 2012, 7:42 PM
[CLOSED] MVC Ajax Automatic binding
What is the propery way, in MVC, to pass a GridPanel item via an Ajax Proxy in order to wire up automatic binding to the parameter of the function, and what is the correct result type to pass back (if any) to the Grid?
For example:
Controller Code
Model:
For example:
Controller Code
<HttpPost()> _
Public Function _AddTeam(ByVal team As CWTeam) As ActionResult
Dim grid As Telerik.Web.Mvc.GridModel
Dim results As New List(Of Models.CWTeam)
Dim svc As New Services.TeamService
results.Add(svc.CreateTeam(team))
grid = New Telerik.Web.Mvc.GridModel(results)
Return View(grid)
End Function
Model:
Namespace Models
Public Class CWTeam
#Region "Properties"
<DisplayName("Team ID")> _
Public Property CWTeamID As Integer
Get
Return Me._CWAssignmentTeamID
End Get
Set(ByVal value As Integer)
Me._CWAssignmentTeamID = value
End Set
End Property
<Required(), DisplayName("Team Name")> _
Public Property Name() As String
Get
Return _name
End Get
Set(ByVal value As String)
_name = value
End Set
End Property
#Region "ForeignKeys"
<Required(), DisplayName("Reviewer")> _
Public Property ReviewerEmployeeID As Integer
Get
Return Me._reviewerEmployeeID
End Get
Set(ByVal value As Integer)
Me._reviewerEmployeeID = value
End Set
End Property
<Required(), DisplayName("QA Reviewer")> _
Public Property QAReviewerEmployeeID As Integer
Get
Return Me._qaReviewerEmployeeID
End Get
Set(ByVal value As Integer)
Me._qaReviewerEmployeeID = value
End Set
End Property
<Required(), DisplayName("Drafter")> _
Public Property DrafterEmployeeID As Integer
Get
Return Me._drafterEmployeeID
End Get
Set(ByVal value As Integer)
Me._drafterEmployeeID = value
End Set
End Property
<Required(), DisplayName("Correspondent")> _
Public Property CorrespondentEmployeeID As Integer
Get
Return Me._correspondentEmployeeID
End Get
Set(ByVal value As Integer)
Me._correspondentEmployeeID = value
End Set
End Property
#End Region
<Required(), DisplayName("Last Modified"), [ReadOnly](True)> _
Public Property LastModified As Date
Get
Return Me._lastModified
End Get
Set(ByVal value As Date)
Me._lastModified = value
End Set
End Property
#End Region
#Region "Local"
Private _name As String
Private _CWAssignmentTeamID As Integer
Private _lastModified As Date
Private _reviewerEmployeeID, _qaReviewerEmployeeID, _drafterEmployeeID, _correspondentEmployeeID As Integer
#End Region
End Class
End Namespace
Last edited by Daniil; Jun 11, 2012 at 2:34 PM.
Reason: [CLOSED]