[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.mobile

access itemtemplate controls in ItemDataBind event handler

Tomás

4/27/2006 1:27:00 PM

Hi,

I am trying to access controls in the ItemTemplate of an objectlist. No
matter what I try I cannot find them.

What I'm trying to do: I have a <mobile:TextView> control in the
ItemTemplate. Then, depending on the value of a particular field when I
am binding to the objectlist, I want to hide/show that TextView
control. But as I said, I can't get reference the control in
ItemDataBind. Here is my code:


<ItemTemplate>
<mobile:TextView Visible=true Runat=server
ID="txtProjectName"></mobile:TextView>
</ItemTemplate>



Code Behind:

Private Sub olTasks_ItemDataBind(ByVal sender As Object, ByVal e As
System.Web.UI.MobileControls.ObjectListDataBindEventArgs) Handles
olTasks.ItemDataBind
Dim tempControl As MobileControls.TextView =
e.ListItem.FindControl("txtProjectName")
If e.ListItem("project_name") = prevProjectName Then
tempControl.Visible = False
Else
prevProjectName = e.ListItem("project_name")
tempControl.Text = e.ListItem("project_name")
tempControl.Visible = True
End If
End Sub


Any help would be greatly appreciated as are alternative methods of
doing what I'm trying to do!

Thanks in advance,

Tomás