本文介绍了如何在c#.net中设置linkbutton enable false的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我的aspx页面中有4个链接按钮.

如果单击了一个linkbutton,那么我将启用false设为灰色,并为我的linkbutton文本设置灰色

达到这个工作罚款

但是我的问题是,如果我单击另一个链接按钮,那么我的第一个链接按钮必须更改为启用true,并且文本颜色也必须更改.但是我的第一个链接按钮消失了.


如何仅设置一个linkbutton启用false,而其他linkbutton可见true

请帮助我

Hi,

I have 4 link buttons in my aspx page.

if one linkbutton has clicked then i put as enable false and set gray color to my linkbutton text

up to this working fine

but my problem is that if i click another linkbutton then my first linkbutton have to change enable true and text color has to change.but my first linkbutton is disappeared.


how to set only one linkbutton enable false and other linkbuttons are visible true

please help me

推荐答案

<asp:LinkButton ID="LinkButton1" runat="server" Font-Bold="True"

       Font-Underline="False" onclick="LinkButton1_Click">one</asp:LinkButton><br />
   <asp:LinkButton ID="LinkButton2" runat="server" Font-Bold="True"

       Font-Underline="False" onclick="LinkButton2_Click">two</asp:LinkButton><br />
   <asp:LinkButton ID="LinkButton3" runat="server" Font-Bold="True"

       Font-Underline="False" onclick="LinkButton3_Click">three</asp:LinkButton><br />
   <asp:LinkButton ID="LinkButton4" runat="server" Font-Bold="True"

       Font-Underline="False" onclick="LinkButton4_Click">four</asp:LinkButton><br />




C#代码:




C# code:

protected void LinkButton1_Click(object sender, EventArgs e)
  {
      LinkButton1.Enabled = false;
      LinkButton2.Enabled = true;
      LinkButton3.Enabled = true;
      LinkButton4.Enabled = true;
      LinkButton1.BackColor = System.Drawing.Color.Gray;
  }
  protected void LinkButton2_Click(object sender, EventArgs e)
  {
      LinkButton2.Enabled = false;
      LinkButton1.Enabled = true;
      LinkButton3.Enabled = true;
      LinkButton4.Enabled = true;
      LinkButton2.BackColor = System.Drawing.Color.Gray;
  }
  protected void LinkButton3_Click(object sender, EventArgs e)
  {
      LinkButton3.Enabled = false;
      LinkButton1.Enabled = true;
      LinkButton2.Enabled = true;
      LinkButton4.Enabled = true;
      LinkButton3.BackColor = System.Drawing.Color.Gray;
  }
  protected void LinkButton4_Click(object sender, EventArgs e)
  {
      LinkButton4.Enabled = false;
      LinkButton1.Enabled = true;
      LinkButton3.Enabled = true;
      LinkButton2.Enabled = true;
      LinkButton1.BackColor = System.Drawing.Color.Gray;
  }


这篇关于如何在c#.net中设置linkbutton enable false的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-26 18:35