title: How do I disable a hyperlink when value from db is 0 for a particular row?
body: <p>We have a bunch of records on the db.</p>
  
  <p>Some have zero (0) values.</p>
  
  <p>Then on the markup, we have the following link:</p>
  
  <p><code>&lt;asp:HyperLink ID="hypG773" runat="server" Text="Get It" navigateurl='&lt;%# String.Format("gets.aspx") %&gt;' Target="_blank"   /&gt;</code></p>
  
  <p>We would like to disable the hyperlink above if the value of a particular record is 0.</p>
  
  <p>The code below:</p>
  
  <pre><code>Protected Sub DataList1_ItemDataBound(ByVal sender As Object, ByVal e As DataListItemEventArgs)
      If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then
          Dim sid As Integer
          Dim dr As DataRowView = TryCast(e.Item.DataItem, DataRowView)
          sid = dr("sid")
  
          If sid = "0" Then
              Dim lnkbtn As HyperLink = DirectCast(e.Item.FindControl("hypG773"), HyperLink)
              lnkbtn.Enabled = False
          End If
      End If
  End Sub
  </code></pre>
  
  <p>gives me the following error:</p>
  
  <p><strong>Input string was not in a correct format.</strong> </p>
  
  <p>The error points to this line below:</p>
  
  <p><strong>Line 38:            sid = dr("sid")</strong></p>
  
  <p>I think it has to do with data type.</p>
  
  <p>Sid is of integer data type.</p>
  
  <p>Thanks for your help</p>