how can i get the button's command argument?

.net, asp.net, c#, javascript, visual-studio

Solution

Make your own attribute and get it with standard JavaScript:

Markup:

<asp:LinkButton ID="LinkButton1" cmdname="test" CommandName="test" CommandArgument="1" 
    runat="server" onclick="LinkButton1_Click">LinkButton</asp:LinkButton>

Script:

//however you choose to get the element, jQuery...etc
document.getElementById('<%=LinkButton1.ClientID %>').cmdname

Problem

Is it possible to get a button's command argument in javascript. I don't want to manipulate it, i just want to read it. If possible - how?

Original source