I am displaying file names from a document library. I want this name to be click able.
So let's say if file name being displayed is: my file.docx
When user clicks, it should take user to its respective item in document library: http://myserver/mylibrary/my file.docx
I am using following code to display file names but problem is I am unable to get current item name and it is actually displayed as:
http://myserver/mylibrary/LinkFilename
name = new HyperLinkField();
name.DataTextField = "LinkFilename";
name.SortExpression = "LinkFilename";
name.HeaderText = "File Name";
name.NavigateUrl = SPContext.Current.Site.Url + "/" + libraryTitle + "/" + name.DataTextField;
grid.Columns.Add(name);