M
MattB
Hey all. I think this should be a simple question for many of you. I
have a simple guestbook type of page I'm making with asp.net/vb.net.
It's generally going well, but I want to give visitors the option of
hiding their email addresses. I've got a boolean field in my (very
simple) table to indicate the state of a checkbox the user can check.
So I've created an OnItemDatabound event tied to my Datalist that
displays the guestbook entries. My event looks like this:
-----------------
Protected Sub dlGuests_DataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataListItemEventArgs)
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem Then
If e.Item.DataItem("hide_email") Then
e.Item.DataItem("email") = "<i>hidden</i>"
End If
End If
End Sub
-----------------
If I step through it the code is executing, and I do hit my condition
(If e.Item.DataItem("hide_email")) which then executes the code that I
thought would change the email address text to thew word "hidden".
But the email address still displays. What am I doing wrong? I suspect
it's the assignment of e.Item.DataItem("email") but I swear I've done
that successfully in the past.
Thanks!
Matt
have a simple guestbook type of page I'm making with asp.net/vb.net.
It's generally going well, but I want to give visitors the option of
hiding their email addresses. I've got a boolean field in my (very
simple) table to indicate the state of a checkbox the user can check.
So I've created an OnItemDatabound event tied to my Datalist that
displays the guestbook entries. My event looks like this:
-----------------
Protected Sub dlGuests_DataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataListItemEventArgs)
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem Then
If e.Item.DataItem("hide_email") Then
e.Item.DataItem("email") = "<i>hidden</i>"
End If
End If
End Sub
-----------------
If I step through it the code is executing, and I do hit my condition
(If e.Item.DataItem("hide_email")) which then executes the code that I
thought would change the email address text to thew word "hidden".
But the email address still displays. What am I doing wrong? I suspect
it's the assignment of e.Item.DataItem("email") but I swear I've done
that successfully in the past.
Thanks!
Matt