(from q in table
 orderby Math.Abs(18 - q.Number)
 select q).FirstOrDefault()


and

SELECT TOP 1
    *
FROM
    table
ORDER BY
    ABS(10 - Number)


and for a datetime

var nearTo = new DateTime(1999, 12, 31);
(from q in table
 orderby Math.Abs((nearTo - q.Date).TotalSeconds)
 select q).FirstOrDefault()


linq sql where closest to number
I am working on a Visual Web Part for a SharePoint 2013 site that is a "scoreboard" for people to track progress on a project. Basically what I have is a lot of textboxes that users will enter values in. I want the values to stay in the textbox until someone changes it.

&lt;tr&gt;
    &lt;td&gt;&amp;nbsp;&lt;/td&gt;
    &lt;td&gt;A-Crew&lt;/td&gt;
    &lt;td&gt;B-Crew&lt;/td&gt;
    &lt;td&gt;C-Crew&lt;/td&gt;
    &lt;td&gt;D-Crew&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
    &lt;td&gt;Daily&lt;/td&gt;
    &lt;td&gt;
        &lt;input id="msaCrewDaily" type="text" /&gt;
    &lt;/td&gt;
    &lt;td&gt;
        &lt;input id="msbCrewDaily" type="text" /&gt;
    &lt;/td&gt;
    &lt;td&gt;
        &lt;input id="mscCrewDaily" type="text" /&gt;
    &lt;/td&gt;
    &lt;td&gt;
        &lt;input id="msdCrewDaily" type="text" /&gt;
    &lt;/td&gt;
&lt;/tr&gt;


A few things I have tried are using PHP inside the input tag to save the value but it doesn't keep it after closing and re-opening the page with webpart on it. I've thought about using local storage but i'm not sure if that will work. 

My Question

Is there a way to keep the the input even if the page is closed? If not would it be better to set up a list as a Data Source? Is the something I could do in C# to keep the values?

Other Information

This is a temporary solution until a database is set up then the values will come from there. However its going to take some time to set that up. Also as of now all my code is HTML and CSS. Any help or ideas are very much appreciated and thank you in advanced!!!
