Guid field validation?http://forums.asp.net/t/1798541.aspx/1?Guid+field+validation+Tue, 01 May 2012 19:23:59 -040017985414958554http://forums.asp.net/p/1798541/4958554.aspx/1?Guid+field+validation+Guid field validation? <p>Hi</p> <p>I have a partial view page where I am using the html dropdownlist control using viewmodel. I haven't specified any validation control on my viewmodel however when I submit the form with default value it asks me to select the value. I can see the source code of the page which includes&nbsp;<strong>class=&quot;input-validation-error&quot;&nbsp;</strong>I couldn't remove that class file also wondering how/why does it includes when I haven't specified the validation for that field. In my viewmodel the field datatype is GUID. Does it include validation by default for the GUID? please find my html code below</p> <pre class="prettyprint">@Html.DropDownListFor(m =&gt; m.Subcategory, new SelectList(Model.SubCategories, &quot;ID&quot;, &quot;Name&quot;, Model.Subcategory), &quot;Please Select...&quot;, new { @id = &quot;subcats&quot; })</pre> <p></p> 2012-04-30T15:53:59-04:004958573http://forums.asp.net/p/1798541/4958573.aspx/1?Re+Guid+field+validation+Re: Guid field validation? <p>The reason you get validation even though you haven't specificed it is because the GUID is non nullable. In Asp.net MVC if you have a non-nullable field (like an int) then that field is considered required and validation attributes are written to the client. This happens with GUID, int and any field that can't be null. If you don't want validation then you need to use a nullable GUID - &quot;GUID?&quot; &nbsp;as the type in your viewmodel.</p> 2012-04-30T16:06:40-04:004959265http://forums.asp.net/p/1798541/4959265.aspx/1?Re+Guid+field+validation+Re: Guid field validation? <p>Thanks. Wondering is there any other way that I could include value to my option label on the dropdownlist?</p> 2012-05-01T05:49:44-04:004960201http://forums.asp.net/p/1798541/4960201.aspx/1?Re+Guid+field+validation+Re: Guid field validation? <p></p> <blockquote><span class="icon-blockquote"></span> <h4>kamaleswaran</h4> <p></p> <p>Thanks. Wondering is there any other way that I could include value to my option label on the dropdownlist?</p> <p></p> </blockquote> <p></p> <p>What do you mean? Can you elabroate on what you trying to do?</p> 2012-05-01T15:54:28-04:004960490http://forums.asp.net/p/1798541/4960490.aspx/1?Re+Guid+field+validation+Re: Guid field validation? <p>I was refering to this&nbsp;<a href="http://forums.asp.net/t/1798744.aspx/1?Inserting&#43;new&#43;row&#43;in&#43;dropdownlistfor&#43;control">http://forums.asp.net/t/1798744.aspx/1?Inserting&#43;new&#43;row&#43;in&#43;dropdownlistfor&#43;control</a></p> <p>I have sorted this now. Thanks!</p> 2012-05-01T19:23:59-04:00