Hi,
I wanted to set attribues of a link button on the ItemDataBound event of a GridView. There the Link button is under a Item template of the GridView.
This is what how I tried in the code behind.
protected
void gridViewRowDataBound(object sender, ListViewItemEventArgs e)
{
if (e.Item.ItemType == ListViewItemType.DataItem){
LinkButton portalUrl = (LinkButton)e.Item.FindControl("portalUrl");
object pwdataRowObject = ((ListViewDataItem)e.Item).DataItem;
DataRowView pwdataRowView = (DataRowView)pwdataRowObject;
portalUrl.Attributes.Add(
"href", pwdataRowView["PortalURL"].ToString());
portalUrl.Attributes.Add("src", "/images/iconNav.jpg");
}
}
Called this method on the GridView method":
<
asp:GridView ID="testGridView" runat="server" AutoGenerateColumns="False" CssClass="myTable1" Width="439px" OnRowDataBound="gridViewRowDataBound">
Issue: This compiles OK, but when this executes getting error saying "Unknown Error", please advice me