Click here to Skip to main content
15,881,424 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Greetings,

I have a modelview which contains several textboxes with default values. Lets say Field A with default value AA. I start the program and the screen with the default values appear correctly. Then I change the values of the textbox A to BB. I submit (post) the screen. And the refreshed screen pops up (by Controller) of course. To my surprice the default value AA pops up again and not the value BB.

During the post in the Controller, I checked the values and the modelview contained the right value BB.

Questions How can I get the value BB in field A after a post on the screen?

I checked the internet, but couldn't find any answer.

Thanks for any help.

Greetings Peter Bellen, The netherlands
Posted
Comments
Nathan Minier 8-Jan-16 7:39am    
We need to see the update action on the controller at a minimum to help you with this issue.
pbellen 8-Jan-16 8:37am    
Hello Nathan,

The complete HttpPost contains following:

[HttpPost]
public ActionResult CalculateDuration(CalcDurViewModel CalcDurViewModel)
{
//Hier alle zaken berekenen en weer in de classes stoppen

//Get Global Options and put them in CalcDurViewModel
clsDatabase CLSDatabase = new clsDatabase();
var lList = CLSDatabase.GetGlobalOptionsA(1);
foreach (tbGlobalOptions TBGlobalOptions in lList)
{
CalcDurViewModel.GeneralViewModel.Id = TBGlobalOptions.ID;
CalcDurViewModel.GeneralViewModel.PHPM = TBGlobalOptions.PHPM.ToString();
CalcDurViewModel.GeneralViewModel.LRPH = TBGlobalOptions.LRPH.ToString();
CalcDurViewModel.GeneralViewModel.MethodSize = TBGlobalOptions.MethodSize;
CalcDurViewModel.GeneralViewModel.MoneyUnit = TBGlobalOptions.MoneyUnit;
CalcDurViewModel.GeneralViewModel.ColorTrendline1 = TBGlobalOptions.ColorTrendline1;
CalcDurViewModel.GeneralViewModel.ColorTrendline2 = TBGlobalOptions.ColorTrendline2;
CalcDurViewModel.GeneralViewModel.ColorTrendline3 = TBGlobalOptions.ColorTrendline3;
CalcDurViewModel.GeneralViewModel.ColorOptimal = TBGlobalOptions.ColorOptimal;
CalcDurViewModel.GeneralViewModel.ColorWished = TBGlobalOptions.ColorWished;
}




double Sloc = double.Parse(CalcDurViewModel.GeneralViewModel.txtSLOC, System.Globalization.CultureInfo.InvariantCulture);
double PHPM = double.Parse(CalcDurViewModel.GeneralViewModel.PHPM, System.Globalization.CultureInfo.InvariantCulture);
double LRPH = double.Parse(CalcDurViewModel.GeneralViewModel.LRPH, System.Globalization.CultureInfo.InvariantCulture);
double GF = double.Parse(CalcDurViewModel.GeneralViewModel.txtGF, System.Globalization.CultureInfo.InvariantCulture);

double PIExpectedInput = double.Parse(CalcDurViewModel.DataTrendlineViewModel.lblPITable, System.Globalization.CultureInfo.InvariantCulture);
double EffortInput = double.Parse(CalcDurViewModel.DataTrendlineViewModel.lblPersonHoursTable, System.Globalization.CultureInfo.InvariantCulture);

Calculations CLSCalculations = new Calculations();

double PP = CLSCalculations.Calculate_ProdPar_From_PI(PIExpectedInput);

double dDuration_Recalc = CLSCalculations.Calculate_Duration(Sloc, EffortInput, PP);
double dSize_Recalc = Sloc;
double dPI_Recalc = PIExpectedInput;
double dPersonMonths_Recalc = EffortInput;
double dPersonHours_Recalc = dPersonMonths_Recalc * PHPM;
double dAvgPersons_Recalc = dPersonHours_Recalc / dDuration_Recalc / PHPM;
double dCost_Recalc = dPersonHours_Recalc * LRPH;
double dHoursPerFP_Recalc = dPersonHours_Recalc * GF / dSize_Recalc;


ModelState.Clear();

//Peakstaff
double dPeakStaff_Recalc = dPersonMonths_Recalc / dDuration_Recalc * 1.3;

//MBI calculation
double dMBP_21 = CLSCalculations.Calculate_MBP2(dPersonMonths_Recalc, dDuration_Recalc);
double dMBI_Recalc = CLSCalculations.Calculate_MBIFromMBP(dMBP_21);

//Data to screen
double dValue;
dValue = Math.Round(dSize_Recalc, 0);
CalcDurViewModel.RecalculatedDataViewModel.lblSizeCalc = dValue.ToString("N02", System.Globalization.CultureInfo.InvariantCulture);

dValue = Math.Round(dPI_Recalc, 1);
CalcDurViewModel.RecalculatedDataViewModel.lblPICalc = dValue.ToString("N02", System.Globalization.CultureInfo.InvariantCulture);

dValue = Math.Round(dDuration_Recalc, 1);
CalcDurViewModel.RecalculatedDataViewModel.lblDurationCalc = dValue.ToString("N02", System.Globalization.CultureInfo.InvariantCulture);

dValue = Math

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