How to find a label in a asp repeater

Posted by citrus on Stack Overflow See other posts from Stack Overflow or by citrus
Published on 2010-06-09T18:16:39Z Indexed on 2010/06/09 18:22 UTC
Read the original article Hit count: 276

Filed under:
|
|
|

Structure of my asp: repeater

repeater
    updatePanel
         label1 (rating)
         button (updates rating)
         some_picture (thing being rated)
     /update panel
/repeater

Imagine the output of the above repeater containing 100 rows. (1 label, and 1 button on each row).

Goal: when I click the button, I want the appropriate label to be updated. I dont know how to do this. I can reference a label via:

Label myLabel2Update = (Label)Repeater1.Controls[0].Controls[0].FindControl("Label1");

But ofcourse, it will be the same label each time (not necessarily the label that needs to be updated). I need to update the label that is on the same row as the button.

Any guidance would be appreciated.

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET