Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspdotnet_website_programming thread: databind event


Message #1 by Greg Partin <GPartin@c...> on Fri, 26 Apr 2002 11:57:05 -0400
Hi folks,

I'm trying to manipulate some data before it is bound to a datagrid.  I'm
retrieving some values from a database and placing them into hyperlink
controls.  If the number is greater than zero it should be clickable....if
it is 0 then it should not be clickable.  Can anyone point me in the right
direction.  I'm doing something along these lines:

Sub CheckLink_ItemDataBound(ByVal sender As Object, ByVal e As
DataGridItemEventArgs)

        If (e.Item.ItemType = ListItemType.Item) Or (e.Item.ItemType 
ListItemType.AlternatingItem) Then

            If lblnumtaken.Text.ToString = "0" Then
                e.Item.Cells(3).Enabled = False
            End If

        End If

End Sub

***This is my decleration in the aspx code for the hyperlink

<asp:TemplateColumn HeaderText="Students Tested">
	<ItemTemplate>
		<asp:Hyperlink id="hlStudentsTested" runat="server"
NavigateUrl='<%#
"http://localhost/BeginningTests/reports/rpt_ClassProgressReportResults.aspx
%>'>
		<asp:Label Text='<%#
Container.DataItem("num_students_taken") %>'runat='server' ID="lblnumtaken"
/>
		</asp:Hyperlink>
	</ItemTemplate>
</asp:TemplateColumn>

Any help would be greatly appreciated.

thanks,
Greg

  Return to Index