C# 在c中单击链接按钮后禁用链接按钮#
我想禁用链接按钮后,点击它,并启用其他。使用c#在两个链接按钮之间切换启用/禁用。订阅此按钮的单击事件,并将Enabled属性设置为true或falseC# 在c中单击链接按钮后禁用链接按钮#,c#,asp.net,user-interface,C#,Asp.net,User Interface,我想禁用链接按钮后,点击它,并启用其他。使用c#在两个链接按钮之间切换启用/禁用。订阅此按钮的单击事件,并将Enabled属性设置为true或false void LinkButton_Click(Object sender, EventArgs e) { // First enable all buttons btn1.Enabled = true; btn2.Enabled = true; // Then disable the click
void LinkButton_Click(Object sender, EventArgs e)
{
// First enable all buttons
btn1.Enabled = true;
btn2.Enabled = true;
// Then disable the clicked button
(sender as Control).Enabled = false;
...
}
这只是一个例子,说明了如何做到这一点。可以优化…要禁用链接按钮,应将其属性指定为false:
button.Enabled = false;
还有一个例子是如何在链接的MSDN文章中钩住OnClick事件。我的页面包含这样的链接-so。如何做?使用javascript或css?我的答案是使用ASP.NET和C#的therms。对于Javascript答案,您应该重新表述问题。