本文介绍了如何在LinkButton1_Command中更改链接按钮颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 您好, 如何更改链接按钮颜色 $ b链接命令事件中的$ b Hello, how to change the link button colorin the link command eventprotected void LinkButton1_Command(object source, CommandEventArgs e) { if (e.CommandName.Equals("Paging")) { var lbtn = (LinkButton)FindControl("LinkButton1" + e.CommandArgument); lbtn.ForeColor = System.Drawing.Color.Red; lbtn.ForeColor = System.Drawing.Color.Blue; } } i正在做但是null异常thow 如何找到链接控制 Regrads Sadhana.R.Belge i am doing but null exception thowhow can i find link Control RegradsSadhana.R.Belge推荐答案 <asp:LinkButton ID="ENameLinkBtn" runat="server" style="font-weight: 700; font-size: 8pt;" CommandArgument="YourValueHere" OnClick="LinkButton1_Command" > 在代码背后 In Code Behindprotected void LinkButton1_Command(object sender, CommandEventArgs e){ LinkButton btn = (LinkButton)(sender); string yourValue = btn.CommandArgument; // e.CommandArgument if(btn != null) { // do what you need here btn.ForeColor = System.Drawing.Color.Red; }} 这篇关于如何在LinkButton1_Command中更改链接按钮颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 11-03 03:45