How Can I Get The Button's Command Argument?
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?
Solution 1:
Make your own attribute and get it with standard JavaScript:
Markup:
<asp:LinkButtonID="LinkButton1"cmdname="test"CommandName="test"CommandArgument="1"runat="server"onclick="LinkButton1_Click">LinkButton</asp:LinkButton>
Script:
//however you choose to get the element, jQuery...etcdocument.getElementById('<%=LinkButton1.ClientID %>').cmdname
Solution 2:
You can put command argument into some hidden field, then retrieve the value of the hidden field in javascript after page loads such as $(document).ready() in JQuery.
Solution 3:
The short answer is NO if you are ONLY using javascript. But you could retrieve it with an ajax call to the server or using a hidden field like J.W. suggested. This property is not even accessible from themes. For more info read the documentation in msdn
Post a Comment for "How Can I Get The Button's Command Argument?"