asp.net在更新面板添加行到表 [英] asp.net adding row to a table in update panel

查看:97
本文介绍了asp.net在更新面板添加行到表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想添加一些行我的UpdatePanel表控制。我有更新面板按钮并单击按钮时,部分回发发生,在button_click处理我加1行的表。我可以触发回发事件,我可以每次加1列,但问题是,每一次页面postedback我得到的初始表,这意味着我在$ P $添加的所有行pvious回发都消失了,我怎么能解决这个问题?任何想法,欢迎?

I'm trying to add some rows to a table control in my updatepanel. I have a button in update panel and when the button is clicked, partial postback happens, in button_click handler I add 1 row to the table. I can trigger the postback event and I am able to add 1 row each time, but the problem is that every time the page is postedback I got the initial table, meaning all the rows I've added in previous postbacks are gone, how can I solve this? Any ideas are welcome?

推荐答案

当您在表中添加行,您还需要保存敲桌子和其他地方,例如在视图状态或数据库上或某处,然后重新创建它,因为后面的code和页面它自身没有对表为你做什么记忆,不知道你对一般的DOM做什么。

When you add rows in the table, you also need to save the struck of the table and somewhere else, for example on the view state, or on a database, or somewhere, and then recreate it because the code behind and the page it self did not have "a memory for what you do" on a table, did not know what you do on the DOM in general.

您可能会看到桌上的页面上,但是当您发表的帖子后面,code后面没有拿到后回敲桌子的,只能从输入控件的发布的数据,所以没有默认你有什么在桌子上进行认识,并且从一开始就使得它

You may see the table on the page, but when you make a post back, the code behind did not get the post back of the struck of the table, only the posted data from input controls, so did not know by default what you have done on the table, and renders it from the beginning.

所以,如果你赢得了在表中添加行,你赢得记得他们在接下来的文章后面,保存你的结构也是其他地方,当我说你的结构,我不是说所有的表,你可以简单的节省数,例如,你有多少行添加或数字和一个ID,多少行,什么是对每一行,然后添加新行之前,并在每一个岗位回来,你重新创建表。

So, if you won to add rows in a table, and you won to remembers them on the next post back, save your struct also somewhere else, and when I say your struct, I do not mean all the table, you can simple save a number, eg how many rows you have add, or a number and an id, how many rows and what is on every row, and then before you add new rows, and on every post back, you recreate the table.

这篇关于asp.net在更新面板添加行到表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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