We help IT Professionals succeed at work.
Get Started

Item bata bound event causing an error

kdeutsch asked
Last Modified: 2012-05-08
I am trying to create a databound event for my hyperlink when it is blank from the database.
but when I impliment it it causes errors on the datagrid, but when I put same code in db it works, it also works when I comment out the ItemDatabound event, but what happens is some items are not links on the datagrid but just blank.

Private Sub myDataGrid_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles myDataGrid.ItemDataBound
        Dim Fixpage As String = e.Item.Cells(4).Text
        Dim hl As HyperLink = e.Item.Cells(4).FindControl("hlFix")

        If Fixpage = " " Or Fixpage = "" Then
            hl.NavigateUrl = "http://sharepoint/JFHQ/JSTAFF/J1/J1ARMY/Mob/Mob%20Tracker%20Fix%20Pages/Fix%20Page%20Library.aspx"
        End If
    End Sub

<asp:TemplateColumn HeaderText="Fix Page">
												<asp:Hyperlink id="hlFix" runat="server" Text="Fix Page" NavigateUrl='<%# DataBinder.Eval (Container.DataItem,"strFilterPage") %>' Target="_blank"></asp:Hyperlink>  

Open in new window

Watch Question
Top Expert 2013
This problem has been solved!
Unlock 2 Answers and 12 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE