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?



Make your own attribute and get it with standard JavaScript:


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


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

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.


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


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.