W
Wayne Wengert
I have an ASP.NET page in which I include a datalist that is bound to a
datareader. I am trying to use the OnItemDataBound event to change the
contents of the NavigateURL property of a hyperlink. I am getting an error I
do not understand. Any explinations woul;d be appreciated. The error report
is:
Compiler Error Message: BC30408: Method 'Public Sub
ItemDataBoundEventHandler(sender As Object, e As
System.Web.UI.WebControls.DataGridItemEventArgs)' does not have the same
signature as delegate 'Delegate Sub DataListItemEventHandler(sender As
Object, e As System.Web.UI.WebControls.DataListItemEventArgs)'.
Source Error:
Line 68: Judge/Caption for Evaluation</asp:Label>
Line 69: <p>
Line 70: <aspataList id="judgelist" runat="server"
onitemdatabound="ItemDataBoundEventHandler">
Line 71: <HeaderTemplate>
Line 72: <table width="90%">
====================================================================
The relevant DataList Code is as follows:
<aspataList id="judgelist" runat="server"
onitemdatabound="ItemDataBoundEventHandler">
<HeaderTemplate>
<table width="90%">
<tr bgcolor="#b0c4de">
<th>
Action</th>
<th>
Judge</th>
<th>
Caption</th>
<th align="center">
Proposed<br />
Status</th>
</HeaderTemplate>
<ItemTemplate>
<tr bgcolor="lightcyan">
<td id="myLink" runat="server">
<asp:HyperLink id="XX" runat="server"
NavigateUrl= strLink Text= "Evaluate" ></asp:HyperLink>
</td>
<td>
<%#Container.DataItem("JudgeName")%>
</td>
..............
The "ItemDataBoundEventHandler" code is as follows:
Sub ItemDataBoundEventHandler(sender as Object, e as DataGridItemEventArgs)
If e.Item.ItemType = ListItemType.Item OR _
e.Item.ItemType = ListItemType.AlternatingItem then
'Check to see if the price is below a certain threshold
Dim strLink as String
strLink = Convert.ToDouble(DataBinder.Eval(e.Item.DataItem,
"price"))
If DataBinder.Eval(e.Item.DataItem, "proposedstatus") Is
DBNull.Value then
strLink = ""
End If
End If
End Sub
datareader. I am trying to use the OnItemDataBound event to change the
contents of the NavigateURL property of a hyperlink. I am getting an error I
do not understand. Any explinations woul;d be appreciated. The error report
is:
Compiler Error Message: BC30408: Method 'Public Sub
ItemDataBoundEventHandler(sender As Object, e As
System.Web.UI.WebControls.DataGridItemEventArgs)' does not have the same
signature as delegate 'Delegate Sub DataListItemEventHandler(sender As
Object, e As System.Web.UI.WebControls.DataListItemEventArgs)'.
Source Error:
Line 68: Judge/Caption for Evaluation</asp:Label>
Line 69: <p>
Line 70: <aspataList id="judgelist" runat="server"
onitemdatabound="ItemDataBoundEventHandler">
Line 71: <HeaderTemplate>
Line 72: <table width="90%">
====================================================================
The relevant DataList Code is as follows:
<aspataList id="judgelist" runat="server"
onitemdatabound="ItemDataBoundEventHandler">
<HeaderTemplate>
<table width="90%">
<tr bgcolor="#b0c4de">
<th>
Action</th>
<th>
Judge</th>
<th>
Caption</th>
<th align="center">
Proposed<br />
Status</th>
</HeaderTemplate>
<ItemTemplate>
<tr bgcolor="lightcyan">
<td id="myLink" runat="server">
<asp:HyperLink id="XX" runat="server"
NavigateUrl= strLink Text= "Evaluate" ></asp:HyperLink>
</td>
<td>
<%#Container.DataItem("JudgeName")%>
</td>
..............
The "ItemDataBoundEventHandler" code is as follows:
Sub ItemDataBoundEventHandler(sender as Object, e as DataGridItemEventArgs)
If e.Item.ItemType = ListItemType.Item OR _
e.Item.ItemType = ListItemType.AlternatingItem then
'Check to see if the price is below a certain threshold
Dim strLink as String
strLink = Convert.ToDouble(DataBinder.Eval(e.Item.DataItem,
"price"))
If DataBinder.Eval(e.Item.DataItem, "proposedstatus") Is
DBNull.Value then
strLink = ""
End If
End If
End Sub