Hi All!
I am having trouble with my GridView in ASP.NET, which is listing a few rows of documents. Some of the rows (i.e. documents) are unpaid and need a shopping icon, which takes the clicker to another page completely. Other rows need no icon since they are paid.
This is what I have so far, although HyperLink is throwing an error saying that it cannot cast a HyperLinkField to a HyperLink. Any ideas? Is it better to create an object of the HyperLinkField through C# instead of ASP for example?
All help is much, much, much appreciated!
//Jenny
protected void getImages(Object src, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
BusinessClasses.BusinessEntities.DocumentEntity dataRow = (BusinessClasses.BusinessEntities.DocumentEntity)e.Row.DataItem;
string status = dataRow.Status.ToString();
TableCellCollection myCells = e.Row.Cells;
if (status == "UnPaid")
{
HyperLink planLink = (HyperLink)myCells[myCells.Count - 1].Controls[0];
planLink.ImageUrl = string.Format("~/Images/Icons/icon_buy.png/");
planLink.ToolTip = "Köp";
}
}
}