Prev: Fastest way to upload images in c sharp
Next: RequiredFieldValidator not working for dependent dropdown
From: AMP on 13 May 2010 14:27 Why does this return "Success" and not the bool that it represents: This Returned <%= Html.LabelFor(m=>m.Success)%> My Property: private bool success = false; public bool Success { get { return success; } set { success = value; } } I dont even get a casting error Thanks
From: Patrice on 13 May 2010 15:00
Hi, LabelFor is to define the label for another form field. So it makes sense to return the property name (or the DisplayName attribute if you want something else) rather than the property value. You may want to use Html.Label instead (not familiar with MVC but I suppose it exists). As a side note creating members differing only in casing is generally considered as a bad practice (error prone and if a library can impair its usage from non case sensitive languages)... -- Patrice "AMP" <ampeloso(a)gmail.com> a �crit dans le message de news:28199196-1abd-4e5d-be5b-93a9c1974673(a)o8g2000yqo.googlegroups.com... > Why does this return "Success" and not the bool that it represents: > > This Returned <%= Html.LabelFor(m=>m.Success)%> > > My Property: > private bool success = false; > public bool Success > { > get { return success; } > set { success = value; } > } > > I dont even get a casting error > > Thanks |