Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

Set Button CommandName tag from const string in code behind.

$
0
0

Should be an easy questionWink

I'm trying to set the CommandName attribute of a button using a const string from the code behind. I have done this before for IDs etc. So this is what I have

<asp:Button ID="test1" CssClass="Buttons" runat="server" Text="Test" OnClick="Test_Click" CommandName="<%=this.TestCommand%>" />

In my code behind I have 

public const string TestCommand = "TestCommand";

In the button handler I get the CommandName = <%=this.TestCommand%>

How do I set the CommandName attribute to = the const string?

Thanks in advance!!


Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>