J
John Doe
Hi I want to convert a column to a link. All examples I
have seen works with bound columns. I have the following
grid:
<asp:datagrid runat="server" id="__theDetailsGrid"
cellpadding="2" cellspacing="0"
OnItemDataBound="Details_Item_Bound">
</asp:datagrid>
It is bound during runtime to a DataTable that is bound to
a SqlDataAdapter. The Details_Item_Bound function changes
the background color based on a value. I have been able to
get that to work with the following code:
private void Details_Item_Bound(object sender,
DataGridItemEventArgs e)
{
if((e.Item.ItemType == ListItemType.Item) ||
(e.Item.ItemType == ListItemType.AlternatingItem))
{
if(e.Item.Cells[1].Text == "FAILED")
{
foreach(TableCell c in e.Item.Cells)
{
c.BackColor = System.Drawing.Color.Red;
}
}
}
}
}
Basically what I would like to do is to set the text in
column number 3 to a hypertext link that will point to
another page if the value is "FAILED" in column 1
Hope you guys understand what I would like to acomplish.
have seen works with bound columns. I have the following
grid:
<asp:datagrid runat="server" id="__theDetailsGrid"
cellpadding="2" cellspacing="0"
OnItemDataBound="Details_Item_Bound">
</asp:datagrid>
It is bound during runtime to a DataTable that is bound to
a SqlDataAdapter. The Details_Item_Bound function changes
the background color based on a value. I have been able to
get that to work with the following code:
private void Details_Item_Bound(object sender,
DataGridItemEventArgs e)
{
if((e.Item.ItemType == ListItemType.Item) ||
(e.Item.ItemType == ListItemType.AlternatingItem))
{
if(e.Item.Cells[1].Text == "FAILED")
{
foreach(TableCell c in e.Item.Cells)
{
c.BackColor = System.Drawing.Color.Red;
}
}
}
}
}
Basically what I would like to do is to set the text in
column number 3 to a hypertext link that will point to
another page if the value is "FAILED" in column 1
Hope you guys understand what I would like to acomplish.