Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <ul> <li>Where do I start? Is this behaviour out of the box or do I implement a SearchBagBinder? I had a quick look at the IModelBinder but can't quite wrap my head around it and the DefaultModelBinder source doesn't make me any the wiser.</li> </ul> </blockquote> <p>It is out of the box. You can either use UpdateModel or ModelBinder to acheive what you are looking to do.</p> <blockquote> <ul> <li>What is this ModelBindingContext?</li> </ul> </blockquote> <p>This contains all the necessary information for the request to be bound to your Model. Similar to ControllerContext and ActionFilterContext, it is basically the state of the ModelBinder and contains all the information necessary to do what you want, if you follow the ASP.NET MVC teams recommendations for what the ModelBinder is supposed to do.</p> <blockquote> <ul> <li>How do I access my form fields?</li> </ul> </blockquote> <pre><code>context.HttpContext.Request.Forms["myformfield"]; </code></pre> <p>or</p> <pre><code>foreach (var field in context.HttpContext.Request.Forms.Keys) { var value = context.HttpContext.Request.Forms[field]; } </code></pre> <blockquote> <ul> <li>What if the values are not passed on by a form but rather by entering a URL directly?</li> </ul> </blockquote> <p>If you need to check both the Form and the QueryString just loop through both collections.</p> <pre><code>foreach (var field in context.HttpContext.Request.Forms.Keys) { var value = context.HttpContext.Request.Forms[field]; } foreach (var field in context.HttpContext.Request.QueryStrings.Keys) { var value = context.HttpContext.Request.QueryStrings[field]; } </code></pre> <p>or you can loop through Param which will contain, Form, QueryString, Headers, etc.</p> <pre><code>foreach (var field in context.HttpContext.Request.Params.Keys) { var value = context.HttpContext.Request.Params[field]; } </code></pre> <blockquote> <ul> <li>Where do I find up-to-date information on this*(most blogs are outdated)? I thought I read a post by Phill at one time, but I can't seem to find it no more.</li> </ul> </blockquote> <p>You have it right Phil is the best place for information as the PM of ASP.NET MVC.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload