hi guys i am new to mvc and i am working on one project...where in my view i need to get a substring of a string in @html.DisplayFor(modelItem=> item.resumelink).
i tried couple of things like
<span>
@Html.LabelFor(modelItem => item.ResumeLink,new {text=item.ResumeLink.Contains("#") ? item.ResumeLink.Substring(0, item.ResumeLink.IndexOf("#")) : item.ResumeLink })
</span>
but it is not working.
i am trying to create display template but i dont know how to get the last index of a file till where i want to crop my string...any help would be appreciated..thnks
Just keep the code clean this way, the idea used here is.. find the index of
#
then find the index of.
and remove all the characters in this index range.Result if
item.ResumeLink = us#fb40c127-9501-40ad-807c-9b8216348005.docx