Accessing controls within a datalist footer template

Discussion in 'ASP .Net' started by Paul Maidment, Aug 7, 2003.

  1. Hi,

    I am a bit green when it comes to .net development so
    please excuse me if this question is obvious or has been
    asked before...

    I am trying to programmatically access a label control
    within a datalist footer template using asp/vb.net. I have
    been searching
    through the documentation but can only find reference to
    creating a footer template programatically, rather than
    accessing the controls within one.

    If anyone has done this, or can point me in the direction
    of some sample code, that would be fantastic!

    Cheers!
     
    Paul Maidment, Aug 7, 2003
    #1
    1. Advertising

  2. Paul Maidment

    Nick Berardi Guest

    try this paul.

    dataList_ItemDataBound (object sender, DataItemEventArgs e) {
    if (e.Item.ItemType == ItemType.Footer) {
    Label l = (Label)e.Cells[0].Controls("labelname");
    l.Text = "New Text";
    }
    }

    I don't have access to a program that I have done this in where you pull
    out the cells and find a control with in them. But I think you will get
    the basic understanding of what has to be done.

    Nick

    Paul Maidment wrote:

    > Hi,
    >
    > I am a bit green when it comes to .net development so
    > please excuse me if this question is obvious or has been
    > asked before...
    >
    > I am trying to programmatically access a label control
    > within a datalist footer template using asp/vb.net. I have
    > been searching
    > through the documentation but can only find reference to
    > creating a footer template programatically, rather than
    > accessing the controls within one.
    >
    > If anyone has done this, or can point me in the direction
    > of some sample code, that would be fantastic!
    >
    > Cheers!
    >
     
    Nick Berardi, Aug 7, 2003
    #2
    1. Advertising

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. Nevyn Twyll
    Replies:
    8
    Views:
    1,970
  2. Replies:
    3
    Views:
    1,016
  3. George

    Access to controls in footer template

    George, May 11, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    5
    Views:
    246
    Leonardo Rodríguez
    May 12, 2004
  4. Henrik
    Replies:
    1
    Views:
    465
    Ken Cox [Microsoft MVP]
    Jul 6, 2006
  5. Will

    Problem with DataList within DataList

    Will, Oct 10, 2007, in forum: ASP .Net Web Controls
    Replies:
    4
    Views:
    200
    Walter Wang [MSFT]
    Oct 18, 2007
Loading...

Share This Page