How to reference an item in a formview template in vs2005

Here is what we are trying to do, in a FormView1 Item template we would like to reference a listbox from another list box, so for example when the user clicks on the first list box and selects a state, the second list box is filled with the county name.

The problem is I can't see ListBox2.text since the name of it becomes something like this:

Formview1.ItemTemplate.ItemTemplate.Listbox1 but we can't reference it.

Please help, thank you.

Dan Stojadinovic
zodex1@gmail.com


Answer this question

How to reference an item in a formview template in vs2005

  • Craig Camm

    Hi

    I am having the same problem . I drag a formview control on to the page . In my code I can type formview1 . something but how do I access the data inside the formview . I would like to :

    if formview1.data("Firstname") = "hello" then

    button1.show

     

    end if

     

    The solution abovedoes not seem to help as I cannot get it to work



  • jsather

    Hi,

    You can use FormView.DataItem property. This article has good sample code http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.formview.dataitem.aspx.

    Best regards,



  • Rusty H

    you need a instance reference to your form:

    Dim f as New Formview1

    Dim MyVar as string = f.listbox2.text

  • How to reference an item in a formview template in vs2005