访问 <asp:table>在asp.net webform中由javascript添加的表格行 [英] Access <asp:table> table rows added by javascript in asp.net webform

查看:25
本文介绍了访问 <asp:table>在asp.net webform中由javascript添加的表格行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个应用程序试图捕获用户添加到控件的多个条目.用户在单个文本框中输入数据,然后单击添加.然后将该值附加到表中,如下所示:<tr><td>some value</td></tr>

have an app that is trying to capture several entries added to an control by the user. The user enteres data into a single text box and then clicks add. This value is then appended to the table like so: <tr><td>some value</td></tr>

我试图避免往返,因此服务器但到目前为止遇到了麻烦.表单回发,但新添加的行不在 .Rows 集合中......这可能吗?

I'm trying to avoid round trips so the server but so far am having trouble. The form posts back but the new added rows aren't in the .Rows collection... is this possible to do?

推荐答案

您无法让在客户端添加的表行出现在服务器端行集合中,因为服务器端表控件无法知道此类修改.

You cannot get table rows added at client side appear into server side row collection because server side table control has no way to know such modifications.

您可以做的最简单的事情是维护一个(或多个隐藏)字段来存储动态添加的行的数据.因此,当表单回发时,您可以通过使用隐藏字段的名称值进行查找,从隐藏字段(如果您使用服务器端隐藏字段)或从 Request.Form 访问数据.

The simplest thing that you can do is to maintain one (or more hidden) fields that stores the data of dynamically added rows. So when form posts back you can access the data from hidden field (if you use server side hidden field) or from Request.Form by looking up using name value of hidden field.

这篇关于访问 &lt;asp:table&gt;在asp.net webform中由javascript添加的表格行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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