如何从aspx页面获取javascript值到代码背后?
问题描述:
大家好,
在我的网络应用程序中,为避免篡改,我想将java脚本变量中的文本框值发送到.cs页面并使用它。但我不想使用隐藏字段。
示例: -
Hi to all,
In my web application to avoid tampering i want to send textbox value in java script variable to .cs page and use it. but i dont want to use hidden field.
Example:-
var data = document.getElementById('<%=RandomList.ClientID%>').value;
我想从后面的代码中使用这个数据值。
请尽可能帮助...提前感谢...
I want to use this "data" value from code behind.
Please help if possible... thanks in advance...
答
var data = <%=my_public_variable_from_code_behind%>; // for a number
var data = "<%=my_public_variable_from_code_behind%>"; // for a string