From: AMP on
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
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