I have a problem with getting value from partial view . my page has reject button(in htmlgridview by using foreach) , when i am click on button it will display a partial view in jquery modelpopup. so then i enter remarks in textbox.i.e is in modelpopup
, iam not getting remarks in to form collection.
My code is :
<% For Each item In ViewData("MyList1")%>
<td aintInfopackreject='<%=item(1)%>'><%="Reject"%></td>
<% Next%>
Script:
if ($(this).attr("aintInfopackreject")) {
$.post(
"ShowRejectPopUp",
{ aintInfopackreject: $(this).attr("aintInfopackreject") },
function(htmlResult) {
$("#RemarksPopUp").remove();
$("#container").append(htmlResult);
$("#RemarksPopUp").dialog();
}
);
}
the above script calls ShowRejectPopUp function for modelpopup, the ShowRejectPopUp function is :
Public Function ShowRejectPopUp(ByVal aintInfopackreject As System.Nullable(Of Integer)) As ActionResult
Dim lobjInfoPackPublish As New InfoPackPublish
Try
lobjInfoPackPublish = lobjInfoPackPublishRepository.GetInfoPackPublishById(aintInfopackreject)
Session("aintInfopackreject") = aintInfopackreject
Return PartialView("RemarksPopUp")
Catch ex As Exception
Throw ex
End Try
End Function
After ModelPop displayed i enter some text into remarks field then i click on save. at that time below fucntion will be called:
Public Function RejectAdvByPub(ByVal collection As FormCollection) As ActionResult
Dim lobjInfoPackPublish As New InfoPackPublish
Dim s As String = collection.Get("txtRemarks") ...........................................' Here Iam getting "s" value is Nothing.....
Try
If Not Session("aintInfopackreject") Is Nothing Then
lobjInfoPackPublish = lobjInfoPackPublishRepository.GetInfoPackPublishById(Session("aintInfopackreject"))
lobjInfoPackPublish.Remarks = collection.Get("hdnRemarks")
lobjInfoPackPublish.Status = 2
lobjInfoPackPublishRepository.UpdateInfoPackPublish()
End If
Catch ex As Exception
Throw ex
End Try
End Function
Thank You.
asp.net mvc2
Mark as answer if this post help you .
Narsa Reddy
Narsa
Member
105 Points
254 Posts
Not Getting Value from Partialview in MVC2?
Apr 08, 2010 02:58 AM|LINK
Hi,
I have a problem with getting value from partial view . my page has reject button(in htmlgridview by using foreach) , when i am click on button it will display a partial view in jquery modelpopup. so then i enter remarks in textbox.i.e is in modelpopup , iam not getting remarks in to form collection.
My code is :
<% For Each item In ViewData("MyList1")%> <td aintInfopackreject='<%=item(1)%>'><%="Reject"%></td> <% Next%> Script: if ($(this).attr("aintInfopackreject")) { $.post( "ShowRejectPopUp", { aintInfopackreject: $(this).attr("aintInfopackreject") }, function(htmlResult) { $("#RemarksPopUp").remove(); $("#container").append(htmlResult); $("#RemarksPopUp").dialog(); } ); } the above script calls ShowRejectPopUp function for modelpopup, the ShowRejectPopUp function is : Public Function ShowRejectPopUp(ByVal aintInfopackreject As System.Nullable(Of Integer)) As ActionResult Dim lobjInfoPackPublish As New InfoPackPublish Try lobjInfoPackPublish = lobjInfoPackPublishRepository.GetInfoPackPublishById(aintInfopackreject) Session("aintInfopackreject") = aintInfopackreject Return PartialView("RemarksPopUp") Catch ex As Exception Throw ex End Try End Function After ModelPop displayed i enter some text into remarks field then i click on save. at that time below fucntion will be called: Public Function RejectAdvByPub(ByVal collection As FormCollection) As ActionResult Dim lobjInfoPackPublish As New InfoPackPublish Dim s As String = collection.Get("txtRemarks") ...........................................' Here Iam getting "s" value is Nothing..... Try If Not Session("aintInfopackreject") Is Nothing Then lobjInfoPackPublish = lobjInfoPackPublishRepository.GetInfoPackPublishById(Session("aintInfopackreject")) lobjInfoPackPublish.Remarks = collection.Get("hdnRemarks") lobjInfoPackPublish.Status = 2 lobjInfoPackPublishRepository.UpdateInfoPackPublish() End If Catch ex As Exception Throw ex End Try End Functionasp.net mvc2
Narsa Reddy