사용자가 장바구니에 항목을 추가 할 수있는 MVC 응용 프로그램을 만들고 있습니다. 또한 특정 품목에 대해 부분 지불을 할 수 있으므로 지불 할 금액을 지정하는 TextBox가 있습니다. Ajax ActionLink를 사용하여 Update/Add to cart 액션을 처리하므로 부분 뷰를 사용하여 화면을 새로 고치지 않고 카트 수를 증가시킬 수 있습니다. 내 문제는 내 PartialViewResult 함수에 TextBox에 입력 된 값을 전달하거나 액세스하는 방법을 찾을 수 없다는 것입니다. 여기 어떻게 PartexViewResult에 texbox에 입력 된 값을 전달할 수 있습니까?
는 ... 여기Public Class StudentSchoolFee_Transaction
Public Property SchoolFeeId As Integer
Public Property Title As String
Public Property Price As Decimal
Public Property AmountDue As Decimal
<DisplayFormat(ApplyFormatInEditMode:=True, DataFormatString:="{0:C2}")>
Public Property Amount As Decimal
Public Property Description As String
Public Property AcceptPartialPayment As Boolean
Public Property StudentId As Integer
Public Property TransactionId As Integer
End Class
Public Class AssignedFeesModel
Public Property StudentId As Integer
Public Property StudentNumber As Long
Public Property SiteId As String
Public Property SelectedSchoolFeeId As Integer
Public Property SelectedAcceptPartial As Boolean
Public Property SelectedAmountDue As Decimal
Public Property SelectedAmount As Decimal
Public Property SelectedTransactionId As Integer
Public Property AssignedFeesCol As System.Collections.Generic.List(Of StudentSchoolFee_Transaction)
Public Sub New()
End Sub
Public Sub New(ByVal _Deliver As EMS.Grid.Deliver, ByVal _StudentId As String)
Dim SelectedStudent As New Library.Student(_Deliver, _StudentId)
AssignedFeesCol = New System.Collections.Generic.List(Of StudentSchoolFee_Transaction)
StudentId = SelectedStudent.Id
StudentNumber = SelectedStudent.StudentNumber
SiteId = SelectedStudent.SiteId
'Load AssignedFeesCol
End Sub
End Class
내 초기로드 ActionResult 내 AddAssignedFee PartialViewResult이 카트 카운트 새로 고칠 수 있습니다 ...
Function AssignedFees(ByVal StudentId As String, Optional ByVal ErrorMessage As String = "") As ActionResult
Dim oDeliver As New EMS.Grid.Deliver
oDeliver.UDLNameOrConnString = ConfigurationManager.ConnectionStrings("DefaultConnection").ConnectionString
Dim m As New AssignedFeesModel(oDeliver, StudentId)
Dim stu As New Library.MealHistoryDB.Student(oDeliver, m.StudentNumber, UserSession.GetSession.DistrictId)
Return View(m)
End Function
Public Function AddAssignedFee(ByVal StudentId As Integer, ByVal SchoolFeeId As Integer, ByVal SelectedAmount As Decimal) As PartialViewResult
Dim oDeliver As New EMS.Grid.Deliver
oDeliver.UDLNameOrConnString = ConfigurationManager.ConnectionStrings("DefaultConnection").ConnectionString
With New Library.Ecommerce.SchoolFee(oDeliver, SchoolFeeId)
.AddToCart(oDeliver, UserSession.GetSession.ParentId, StudentId, SelectedAmount)
End With
Return PartialView("_CartButton") ', New Global.MSM.mobile.CartButton())
End Function
내 모델입니다 그리고 여기 내 아약스 액션 링크입니다 , 첫 번째는 금액이 지정되지 않은 항목 추가를위한 것이며 작동합니다. 두 번째 부분 금액을 가질 수있는 항목을 업데이 트하고 PartialViewResult에 금액을 전달하는 방법을 찾을 수 없습니다.
@Ajax.ActionLink("Add", "AddAssignedFee", "Parent", New With {.StudentId = currentItem.StudentId, .SchoolFeeId = currentItem.SchoolFeeId, .SelectedAmount = currentItem.Amount}, New AjaxOptions() With {.HttpMethod = "POST", .InsertionMode = InsertionMode.Replace, .UpdateTargetId = "btnCartContainer"}, New With {.class = "button"})
@Ajax.ActionLink("Update", "AddAssignedFee", "Parent", New With {.StudentId = currentItem.StudentId, .SchoolFeeId = currentItem.SchoolFeeId, .SelectedAmount = currentItem.Amount}, New AjaxOptions() With {.HttpMethod = "POST", .InsertionMode = InsertionMode.Replace, .UpdateTargetId = "btnCartContainer"}, New With {.class = "button"})
는 또한 업데이트 링크에 대해 ".SelectedAmount = Model.SelectedAmount"시도했지만 나는 PartialViewResult에 입력 된 금액을 전달할 수있는 방법을 찾을 수 없습니다.
제안 사항?
감사합니다. 린제이
당신이 AJAX 호출을 수행하려고 할 수