Hello frenz,
I am trying to modify the template itemized hyperlink on my GridView.
My problem is ,
I have 3 types of status, 'KIV','Complete'&'Incomplete'.
I must display 'KIV' in Red color font with its coresponding linkA.
As for 'Complete', it has to be in 'Green' and matched to linkB.
the 'Incomplete' status should be shown in Black color font and linked it with linkC.
To do this, i used the following method :
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim hLink As String = DataBinder.Eval(e.Row.DataItem, "STATUS").ToString()
If hLink.Equals("KIV") Then
Dim hLnk As HyperLink = CType(e.Row.FindControl("UW Status"), HyperLink)
hLnk.ForeColor = Drawing.Color.Red
hLnk.NavigateUrl = "linkA.asp?AppId=" + DataBinder.Eval(e.Row.DataItem, "APP_ID").ToString()
ElseIf hLink.Equals("Complete") Then
Dim hLnk As HyperLink = CType(e.Row.FindControl("UW Status"), HyperLink)
hLnk.ForeColor = Drawing.Color.Green
hLnk.NavigateUrl = "linkB.asp?AppId=" + DataBinder.Eval(e.Row.DataItem, "APP_ID").ToString()
Else
Dim hLnk As HyperLink = CType(e.Row.FindControl("UW Status"), HyperLink)
hLnk.ForeColor = Drawing.Color.Black
hLnk.NavigateUrl = "linkC.asp?AppId=" + DataBinder.Eval(e.Row.DataItem, "APP_ID").ToString()
End If
End If
End Sub
Problem is, im getting error when i execute the web site.The error description is 'Object reference not set to an instance of an object.'
Plz someoen help me sort it out what is the error with my coding.Realy appreciated.
thanks & regards dev