asp.net文本框回发后不填充 [英] asp.net textbox doesn't populate after postback
问题描述
我使用ASP.NET和C#夫妇文本框计算进入的结果。 TextBox2中具有输入值和点击链接Textbox1的被填充。这工作得很好,我第一次输入的值。但我改变TextBox2中的值第二次,我看到该值被分配到Textbox1的,而在按键的点击调试,但屏幕上显示不出来。我有很多其他控件和母版页。该文本框是一个更新面板内。
有人可以帮助我这是怎么回事?
下面是code:
< ASP:文本框ID =Textbox1的=服务器WIDTH =150像素的TabIndex =6MAXLENGTH =8>< / ASP:文本框&GT ; < ASP:的RequiredFieldValidator ID =RequiredFieldValidator7=服务器的ControlToValidate =TextBox1中的ErrorMessage =*>< / ASP:&的RequiredFieldValidator GT;< ASP:文本框=服务器ID =TextBox2中WIDTH =150像素可见=假>< / ASP:文本框>&安培; NBSP< ASP:ImageButton的=服务器ID =imgCalcAdjRate的ImageUrl =〜/资源/图像/ calrate_0.bmp的onmouseout =this.src ='.. /资源/图像/ calrate_0.bmp'的onmouseover = this.src ='.. /资源/图像/ calrate_1.bmp'HEIGHT =25像素WIDTH =25像素可见=假的onclick =imgCalcAdjRate_Click/>
检查在Page_Load函数回发。
如果(!Page.IsPostBack){}
我觉得你正在失去的岗位信息反馈。该数据被更改,但它得到复位后回来了。
I am using ASP.NET and C# couple text boxes to calculate results entered. Textbox2 has a value entered and on button click Textbox1 gets populated. This works fine the first time I enter the value. But the second time I change the value in Textbox2, I see that the value is being assigned to Textbox1 while debugging on Button click, but doesn't show up on the screen. I have many other controls and a master page. The textboxes are within an update panel.
Can someone help me what's going on?
Here is the code:
<asp:TextBox ID="Textbox1" runat="server" Width="150px" TabIndex="6" MaxLength="8"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ControlToValidate="TextBox1" ErrorMessage="*"></asp:RequiredFieldValidator>
<asp:TextBox runat="server" ID="Textbox2" Width="150px" Visible="false"></asp:TextBox> 
<asp:ImageButton runat="server" ID="imgCalcAdjRate" ImageUrl="~/Resource/Images/calrate_0.bmp" onmouseout="this.src='../Resource/Images/calrate_0.bmp'" onmouseover="this.src='../Resource/Images/calrate_1.bmp'" Height="25px" Width="25px" Visible="false" onclick="imgCalcAdjRate_Click" />
Check the postback in the page_load function.
if(!Page.IsPostBack) {
}
I think you are loosing information on post back. The data is changed, but it get reset on post back.
这篇关于asp.net文本框回发后不填充的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!