在Asp.net HTML表单元素的获取值通过jQuery动态添加
你好我已经写了一些code jQuery中添加在aspx页面新的输入类型的元素!现在我想通过获取这些ASP.NET元素的值!我知道如果我想要实现这个我将不得不存储在隐藏的表单元素每个n值取然后在CS文件隐藏元素VAL!我如果我能得到一个直接/快捷方式柜面有是动态jQuery中增加了几十元的获取在Asp.Net每个动态添加contols值好奇!
Hello there i have written some code in jquery to add new input type elements in aspx page! Now I want to fetch values of these elements via ASP.NET! I know if i want to achieve this i will have to store each values in hidden form elements n then fetching hidden element val in cs file! I am curious if i could get a direct/shortcut way to fetch the values of each dynamically added contols in Asp.Net incase there were dozens of elements which were added dynamically in jquery!
在此先感谢
让每一个您添加到您的网页类,说动元素。回发之前,更新一个HiddenField像这样:
Give every element you add to your page a class, say "dynamic". Before postback, update a HiddenField like so:
var hiddenValues = "";
$(".dynamic").each(function(){
hiddenValues += $(this).val() + ",";
});
$("#hiddenField").val(hiddenValues);
然后在code后面访问逗号分隔的隐藏字段的值。
Then access the comma delimited hidden field value in the code behind.