Skip to content Skip to sidebar Skip to footer

Pass Data From Javascript To Codebehind

All -- I have been trying to find a working example of passing data from a Dojo function to an ASP.Net code behind. THe only post I found that at least offers an easy exampl

Solution 1:

Hidden inputs are how I do it for simple pages.

ASP.Net Markup (simplified):

functionsaveMyData() {
    var myData = resultOfSomeOtherFunction();
    var hiddenInput = document.getElementById('<%=HiddenField1.ClientID %>');
    hiddenInput.value = myData;
}
<asp:HiddenFieldID="HiddenField1" runat="server" />

Code-Behind:

value = HiddenField1.Value;

When I want to get fancy, I'll post it to an API I write via an AJAX call.

Post a Comment for "Pass Data From Javascript To Codebehind"