数据列表新文本框变为空白
问题描述:
大家好,
我有一个从数据库绑定的数据列表.有一个添加按钮可在数据列表中添加新文本框.
现在的问题是,当我在新文本框中和页面上写一些内容时,回发文本框文本变为空白,这是新生成的.为此,我无法将文本保存到数据库中.有什么解决方案吗?
Hello to all,
I have a datalist which is binded from database. There is an add button to add new text box in datalist.
Now the problem is that when I write something in the new textbox and on the page postback textbox text become blank which is new generated. For that I am not able to save the text into the database. Is there any solution for that?
答
我在新文本框中写了一些内容,在页面上发回文本框的文本变成空白
听起来像发生了回发,但一切都消失了.重置为旧值.
您已禁用页面或控件的视图状态,或者正在重置页面加载中的控件值.
继续阅读:了解ASP.NET视图状态 [ ASP.NET页面生命周期 [ ^ ],并了解如何使用 Visual Studio调试器 [使用调试器 [
I write something in the new textbox and on the page postback textbox text become blank
Sounds like a postback happened and all gone. Reset to old values.
Either, you have disabled viewstate for the page or controls or you are resetting the control values in your pageload.
Read on: Understanding ASP.NET View State[^]
But, before moving any forward, you need to read on ASP.NET Page Lifecycle[^] and learn on how to use Visual Studio DEBUGGER[^].
This also: Using the DEBUGGER[^]