views:

151

answers:

1

I have a repeater which displays comments related to a post.

I want to add some functionality where when the user click on the link it goes from:

report this post

to

post has been flagged

how do I access the specific lnkButton? Obviously in ItemDataBound this is easily done, but in the click method I'm not sure how I would do it.

Do I need to do something like:

I tried something like this;

LinkButton lb = repeater.FindControl(LINK_BUTTON_UNIQUE_ID) as LinkButton;
lb.Text = "blah blah blah";

but lb is always null.

Any help would be appreciated, thanks!

+6  A: 

Use the source parameter of the click handler?

protected void MyLinkButton_OnClick(object sender, EventArgs e)
{
    LinkButton b = sender as LinkButton;
    b.Text = "Some Text";
}
Wil P
wow i feel stupid LOLThanks!!!
Jack Marchetti
No problem, Glad to help.
Wil P