问题
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 example is this POST
回答1:
Hidden inputs are how I do it for simple pages.
ASP.Net Markup (simplified):
function saveMyData() {
var myData = resultOfSomeOtherFunction();
var hiddenInput = document.getElementById('<%=HiddenField1.ClientID %>');
hiddenInput.value = myData;
}
<asp:HiddenField ID="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.
来源:https://stackoverflow.com/questions/9576899/pass-data-from-javascript-to-codebehind