开发者

How to change the text of linkbutton inside datalist item template field on linkbutton click event?

I have a linkbutton inside datalist1 item template fi开发者_运维知识库eld, i want when user click on linkbutton then its text would be "enable" and if the linkbutton text is "enable" and panel1 will be visible then again on linkbutton click event linkbutton text would be "disable"and panel1 will be hidden...


Here is the applicable code:

protected void Link_Click(object sender, EventArgs e)
{
    LinkButton link = sender as LinkButton;
    if(link.Text == "enabled")
    {
        link.Text = "disabled";
        panel1.Visible = false;
    }
    else
    {
        link.Text = "enabled";
        panel1.Visible = true;
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜