Reputation: 141
I have a linkbutton inside datalist1 item template field, 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...
Upvotes: 0
Views: 1738
Reputation: 19349
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;
}
}
Upvotes: 1