In my grids I have partials views as my editor templates. In the these editor templates I try to check the values on create and edit using razor if statements. These statements do not seem to work for grid editor templates. Here is an example
@if(Model.UserName!=null)
{
@Html.LabelFor(m=>m.Username)
}
else
{
@Html.TextBoxFor(m=>m.UserName)
}
The if always seems to fail is this because after the template is rendered these statements are no longer there and cannot be reached?
Is the only way to accomplish my task is by altering these elements via jquery in the grid edit event?
@if(Model.UserName!=null)
{
@Html.LabelFor(m=>m.Username)
}
else
{
@Html.TextBoxFor(m=>m.UserName)
}
The if always seems to fail is this because after the template is rendered these statements are no longer there and cannot be reached?
Is the only way to accomplish my task is by altering these elements via jquery in the grid edit event?