asp.net mvc - How can I set a label, that belongs to a model, dynamically? -
so let's have registration model , have:
[display(name = "")]
public string secretquestion { get; set; }
how can load [display(name = "")] dynamically display name secret question. getting question database , need dynamic.
i don't believe can use unobtrusive validation properties dynamic data. need send information view , display manually.
this can accomplished in many ways, depending on how generating views.
a simple way of doing is:
controller:
myviewmodel.secretquestion = getsecretquestion(); view:
@html.displayfor(model => model.secretquestion) @html.textboxfor(model => model.secretquestion)
Comments
Post a Comment