asp.net mvc - Basic age display helper in mvc using c# -
how implement basic age display helper in mvc using c#. stuck code @ moment , need help. can 1 please give quick help.
thanks
my code
@html.displayfor(model.dob.value)
however shows dob in date time format. thinking of doing
var newdate = datetime.now.subtract(model.dob.value) @html.display(newdate)
but want helper, , not repeat this.
please poor student....hahaha
you can build helper function, in helpers folder. take in dob , can format out put string.
for example
public string (this htmlhelper helper, datetime dob){ //do formatting return result; }
here link blog may more useful. used similar 1 project. age display tutorial
cheers.