locked
How to get the ASP Label control RRS feed

  • Question

  • User954116774 posted

    Hi

      i need a help. i am in need to get the the control of the ASP labels dynamically. i have places all these labels in a HTML table by name Lbl1, Lbl2,Lbl3.............. i have loop it and take the control of the label

    dim i as integer=1

    do while(i<10)

    i=i+1

    Loop

    can anyone pls help me.

    Monday, November 3, 2008 12:18 AM

Answers

  • User1789013027 posted

    Hi,

    You can do like this.

    This is an algorithm.

    Please correct it with the syntax of your language i.e. C#.NET, VB.NET, etc.

    dim i as integer = 1

    do while(i<10)

    lbl as Label = CType(FindControl("Lbl" & i.ToString), Label)

    // assign label text or handle label properties here... i.e. lbl.Text = i.ToString

    i = i + 1

    Loop

    Hope this may help you.

    Happy Coding... [Idea]

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, November 3, 2008 6:44 AM

All replies

  • User1789013027 posted

    Hi,

    You can do like this.

    This is an algorithm.

    Please correct it with the syntax of your language i.e. C#.NET, VB.NET, etc.

    dim i as integer = 1

    do while(i<10)

    lbl as Label = CType(FindControl("Lbl" & i.ToString), Label)

    // assign label text or handle label properties here... i.e. lbl.Text = i.ToString

    i = i + 1

    Loop

    Hope this may help you.

    Happy Coding... [Idea]

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, November 3, 2008 6:44 AM
  • User954116774 posted

    Thank you very much .. it is working!!!!

    Monday, November 3, 2008 6:56 AM