如何发布表中的行,通过Javascript增加,在ASP.NET服务器? [英] How to post table rows, added via Javascript, to the server in ASP.NET?

查看:99
本文介绍了如何发布表中的行,通过Javascript增加,在ASP.NET服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题已经前已问:<一href=\"http://stackoverflow.com/questions/6979049/access-asptable-table-rows-added-by-javascript-in-asp-net-webform\">Access &LT; ASP:表&gt;表行通过在asp.net表单的JavaScript补充说。道歉重复的问题,但我真的很想解释为什么是这样的情况。这可能是由于我缺乏关于如何在提交过程中浏览器HTML表格到服务器的了解。

This question has been asked before: Access <asp:table> table rows added by javascript in asp.net webform . Apologies for the duplicate question but I'd really like an explanation why this is the case. It is probably due to my lack of understanding on how browsers process HTML tables on submission to the server.

如果我有一个&LT; HTML&GT;表或&LT; ASP:表&gt;一个aspx页面上的控制,我行添加到它使用JQuery / JavaScript客户端,我为什么不能在一个后回给服务器这些添加的行?

If I have a <HTML> table or an <asp:table> control on an aspx page and I add rows to it client-side using JQuery / Javascript, why can I not include these added rows in a post-back to the server?

我一直在试图得到这个工作,它看起来像基于答案的previous的问题,我不能这样做。但有人可以解释为什么是这样?表本身可以在后回被返回,但唯一的行present是是表中的部分时,它被发送到原来的浏览器中的行。 - 它不包括由浏览器添加的行

I've been trying to get this to work and it looks like I can't do it based on the answer to the previous question. But can someone explain why this is the case? The table itself can be returned in the post-back but the only rows present are the rows that were part of the table when it was sent to the browser originally - it does not include the rows added by the browser.

我还以为有办法包括在后回这些新行,与任何客户端用户输入?

I would have thought there was a way to include these new rows in the post-back, the same as any client-side user input?

推荐答案

在执行POST操作到服务器,只值包括withing的&LT;形式&GT; 元素被张贴将包括在内。这些序列化为键/值对,可使用如萤火和的 Chrome开发者工具的。

When performing a POST operation to the server, only the values included withing the <form> element being posted will be included. These are serialized as Key/Value pairs and can be inspected using tools like FireBug and the Chrome Developer Tools.

经常HTML元素不被发送回服务器。我的意思是,事情就像&LT; D​​IV&GT; &LT;表&gt; 元素不回去服务器,该形式的唯一的值。

Regular HTML elements are not sent back to the server. What I mean is that things like <div> or <table> elements don't go back to the server, only the values of the form.

不幸的是ASP.Net隐藏了许多从你们这些细节。 这是魔术!这既是一个很好的和坏事。它可以很容易的工作幸福地无知的HTTP如何引擎盖下工作细节问题的细节,但可以是痛苦的根源,当你真正需要知道这些细节。

Unfortunately ASP.Net hides a lot of these details from you. It is magic! That is both a good and a bad thing. It makes it easy to work blissfully ignorant of the nitty gritty details of how HTTP works under the hood, but can be a source of pain when you really need to know those details.

这篇关于如何发布表中的行,通过Javascript增加,在ASP.NET服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆