IModelBinder and property key for successful binding at the ModelState + partial form validation

יום חמישי, אוקטובר 28, 2010

I’m talking about asp.net MVC2 The point: if you are implementing an IModelBinder for a type, you should add a call to bindingContext.ModelState.SetModelValue(bindingContext.ModelName, valueFromRequest); this is done to make sure that at your controller action you can access ModelState and nameOfThisProperty  will be present as a key at ModelState also for successful binding.   And for the details: (  Partial form validation including custom modelBinding  for trimming strings) why am I using ModelState...

Good talk on JavaScript performance + some notes

יום שלישי, ספטמבר 28, 2010

Smashing magazine posted a Seven Must-See Videos and Presentations for Web App Developersfinally had the chance to start watching these videos(on the bus :)) The first one deals with Speeding up your JavaScript by Nicholas C. ZakasVery interesting talk:   While watching this remember that you should take the problematic places that need to perform better and make the changes there(as Nicholas also stated at the beginning of the talk and also in this post following the talk).I think that performance should also guide us while writing the code, BUT in most cases - the alternative that uses code that is a bit slower(say...
2 תגובות

jQuery Gotcha: val() might select the wrong option at a select element

יום שני, מרץ 22, 2010

Let's imagine you have the following select element: <select id="someSelect">  <option value="">-Select-</option>  <option value="12">21</option>  <option value="11">20</option>  <option value="10">19</option>  <option value="9">18</option>  <option value="8">17</option>  <option value="7">16</option>  <option value="6">15</option>  <option value="5">14</option>  <option value="4">13</option>  <option value="3">12</option>  <option value="2">11</option>  <option value="1">10</option></select> Notice that the text in some options appears as value in other options.you can get a select like this when composing an age drop down for example. Now for the Gotcha: which option will be chosen as a result of the following expression:$("#someSelect").val("12");???Answer: the selected option will be...
תגובה אחת