M
mplutodh1
I am trying to work with the ItemDataBound property of the DataList to
modify the display for a page that lists future events. Here is the
code:
Sub OnItemDataBound(ByVal sender As Object, e As
DataListItemEventArgs)
If e.Item.ItemType = ListItemType.Item OR e.Item.ItemType =
ListItemType.AlternatingItem then
Dim bolOnline as Boolean =
Convert.ToBoolean(DataBinder.Eval(e.Item.DataItem, "bolReg"))
Dim lblReg As Label
If bolOnline then
lblReg.text = "<a href='registration.aspx?EventID="&
DataBinder.Eval(e.Item.DataItem, "EventID")&"'>Register Online!</a>"
Else
lblReg.text = "Call to Register"
End if
End If
End Sub
I know this probably isn't going to work because I can't have multiple
labels named the same thing, but maybe this gives the idea of what I am
trying to accomplish. If bolReg = true in the database I need a link to
be displayed to take the user to a registration page, but if bolReg =
false then no link should be displayed and it should state Call to
Register.
There are about numerous events that are displayed in the datalist and
each one may or may not have online registration (ie bolReg = true or
false)
Anyone have suggestions on how to tackle this or where I am going
wrong? Right now nothing is being printed out, even if I do a
response.write in the If bolOnline statement.
Thanks in advance
-Matt
modify the display for a page that lists future events. Here is the
code:
Sub OnItemDataBound(ByVal sender As Object, e As
DataListItemEventArgs)
If e.Item.ItemType = ListItemType.Item OR e.Item.ItemType =
ListItemType.AlternatingItem then
Dim bolOnline as Boolean =
Convert.ToBoolean(DataBinder.Eval(e.Item.DataItem, "bolReg"))
Dim lblReg As Label
If bolOnline then
lblReg.text = "<a href='registration.aspx?EventID="&
DataBinder.Eval(e.Item.DataItem, "EventID")&"'>Register Online!</a>"
Else
lblReg.text = "Call to Register"
End if
End If
End Sub
I know this probably isn't going to work because I can't have multiple
labels named the same thing, but maybe this gives the idea of what I am
trying to accomplish. If bolReg = true in the database I need a link to
be displayed to take the user to a registration page, but if bolReg =
false then no link should be displayed and it should state Call to
Register.
There are about numerous events that are displayed in the datalist and
each one may or may not have online registration (ie bolReg = true or
false)
Anyone have suggestions on how to tackle this or where I am going
wrong? Right now nothing is being printed out, even if I do a
response.write in the If bolOnline statement.
Thanks in advance
-Matt