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;
}
}
精彩评论