改变一个LinkBut​​ton的文本中的中继器 [英] Change text of a linkbutton in a repeater

查看:97
本文介绍了改变一个LinkBut​​ton的文本中的中继器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个显示相关的帖子转发器。

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:

报告此帖

后已被标记

我怎么访问特定lnkBut​​ton?很显然,在这的ItemDataBound是很容易做到,但在点击的方法我不知道我会怎么做。

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.

我需要做的是这样的:

我想是这样的;

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

但磅总是空。

任何帮助将是AP preciated,谢谢!

Any help would be appreciated, thanks!

推荐答案

使用点击处理程序的源参数?

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";
}

这篇关于改变一个LinkBut​​ton的文本中的中继器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆