ListView Bind

Discussion in 'ASP .Net' started by shapper, Nov 18, 2007.

  1. shapper

    shapper Guest

    Hello,

    I am creating a ListView at runtime and so I need to implement
    ItemTemplate which inherits ITemplate.

    I added a label to ItemTemplate and I need to data binding it to get
    the value of "Name" from the ListView data source.

    I am having problems in doing this.

    For a GridView ItemTemplate the code would be something like:

    Private Sub lName_DataBinding(ByVal sender As Object, ByVal e As
    System.EventArgs)
    Dim lName As Label = CType(sender, Label)
    Dim gvrContainer As GridViewRow = CType(lName.NamingContainer,
    GridViewRow)
    lName.Text = DataBinder.Eval(gvrContainer.DataItem, "Name")
    End Sub

    Could someone, please help me out?

    Thanks,

    Miguel
     
    shapper, Nov 18, 2007
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Srinivasa Rao Penubarthi

    ListView in .NET

    Srinivasa Rao Penubarthi, Jul 22, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    11,758
    Jay B. Harlow [MVP - Outlook]
    Jul 22, 2003
  2. Charles A. Lackman

    ListView Control

    Charles A. Lackman, Feb 18, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    758
    Charles A. Lackman
    Feb 18, 2004
  3. prasad

    ListView Cursor property

    prasad, May 5, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    621
    prasad
    May 5, 2005
  4. mr2_93
    Replies:
    1
    Views:
    3,889
    mr2_93
    Oct 2, 2005
  5. Replies:
    0
    Views:
    793
  6. Jeremy S
    Replies:
    4
    Views:
    9,782
    Jeremy S.
    Jul 15, 2009
  7. artist
    Replies:
    0
    Views:
    782
    artist
    Jul 12, 2010
  8. .
    Replies:
    0
    Views:
    1,025
Loading...