Click here to Skip to main content
15,920,688 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Please mail me the answer for this question. I have got a create page, in that if I select the RawMaterialReceiptID it should display me the total amount to be paid in respect to that Id and after I get the total amount to be paid, i actually make payment to my supplier and i want thses details to be saved in my db.For this the form needs to be posted twice to the server, but in my action method once it posts it doesnot post it again.I tried different action also, but in vain. The details entered in the form are not carried over to the different action.
Posted
Updated 15-Jul-13 6:33am
v2

Hi
You can use from property for save a value in a method and use from this value in another method.
Please see bellow code:

C#
private int YourProperty { get; set; }

public ActionResult Index()
{
    YourMethod();
    // You Can Use from Your Value
    return View();
}

public void YourMethod()
{
    YourProperty = 10; //Set your Value
}


I hope it's helpful for you.
 
Share this answer
 
You can post a value as many times you like, but your actual task is to pass values between pages/posts.
You have two approaches:
0) when the values are posted the first time, you put them in hidden fields in the second form - and making the view model to retrieve them
1) by using session: simply gather what you need in a session object
+1) You could use the tempdata but it is meant for limited scenarios, so I wouldn't.
+2) You could use also ajax but might be complicated on client side - but you could address this approach in a future project. There are several examples out there, like this: http://www.asp.net/mvc/tutorials/mvc-music-store/mvc-music-store-part-8[^]
I would use approach 1.
 
Share this answer
 
Comments
FirdousNasreen 15-Jul-13 12:31pm    
Sir,Thank You for taking time to answer my question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900