c# - how to add an asterix for the LabelFor helper? -


i building mvc 4 app. have field called organisationid, mandatory.

@html.labelfor(m => m.organisationid) 

i need put asterix after label field required. how access labelfor templates? stored? how create own?

thanks

on model use data annotations

  [required]   [uihint("requiredtemplate")]//this trick should match file name.   [display(name="organization id")]   public string name { get; set; } 

drop new folder in views/shared/displaytemplates create new partial view requiredtemplate.cshtml.

<font style="color:red">*</font>@html.labelfor(m => m) 

in view organization should use displayfor

  <div class="display-field">      @html.displayfor(m => m.name)  </div> 

Comments

Popular posts from this blog

c# - Unity IoC Lifetime per HttpRequest for UserStore -

Change the color of an oval at click in Java AWT -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -