I have to calculate the NavigateUrl of a GridHyperLinkColumn in Gridview.
When I do this i get the result of the previous Datarecord.
So the first Row is empty, the second row gets the link of the first row and so on.
Do I use the wrong event? Whats wrong?
Code
When I do this i get the result of the previous Datarecord.
So the first Row is empty, the second row gets the link of the first row and so on.
Do I use the wrong event? Whats wrong?
Code
| protected void rgFiles_ItemDataBound(object sender, GridItemEventArgs e) | |
| { | |
| if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem ) | |
| { | |
| Telerik.Web.UI.GridHyperLinkColumn ghlc = (Telerik.Web.UI.GridHyperLinkColumn) e.Item.OwnerTableView.Columns[0]; | |
| System.IO.FileInfo fi = (System.IO.FileInfo)e.Item.DataItem; | |
| string s = Server.MapPath("~/upload"); | |
| ghlc.NavigateUrl = "~/upload"+fi.DirectoryName.Replace(Server.MapPath("~/upload"),"")+"/"+fi.Name; | |
| } | |
| } |