Have an MVC app, and a table with data like this:
dbo.ParameterTable
MainThrust AST1 AST2 AST3 AST4 AST5 100 2 2 2 2 2 200 3.4 3.7 4.1 4.4 5.2 500 5 5.6 6.5 7.4 8 1000 8 9.4 11.2 14.4 16 5000 12 14.1 18 20 25
Textbox 1 (AST Value)
Textbox 2 (Mainthrust value)
Textbox 3 resulting value
So if the user enters 2 in textbox 1, this means its value is AST2; then the user enters 500 in Mainthrust, now we have the x and y for this table. How in the view can you use Ajax to send these 2 values into the controller function? And what would the logic be for LINQ to get the value?
function (ValX, ValY)
var resultvalue = (from TempVal in db.ParameterTable
where TempVal.Mainthrust == ValX
select new
{ AST1 }.ToList());
back in the view
ajax
success(data)
var x = JSON.Parse(data);
$('#MyTextbox3').val(x[0].AST1);
Ajax in the View does the call. I already have the trap for catching both textboxes in the View,
$('#Mainthrust').change(function () {when the user adds a value and clicks away from that textbox it comes into the javascript and I have made the code to get the value in the 2 textboxes.
But now? sending these 2 values by ajax and expecting it to return the value within the table there? the column AST2 and Mainthrust value = 200 must return the lookup value of "3.7"
Seems like a useful design pattern, but I have not done much with ajax, thanks for any ideas