文本框值更改未反映在c#后面的代码中 [英] textbox value change not being reflected in code behind c#
问题描述
我正在使用带有C#的.NET framework 1.1。我的问题描述如下。
I am using .NET framework 1.1 with C#. My problem description is given below.
- 我的服务器端文本框控件的id为:= txtFromDate 。视图状态已启用及其只读。
- 第一次加载页面时我在上面的文本框中设置当前日期值。
- 之后我使用jQuery更改文本框的值。
- 然后使用带有一些__EVENTTARGET参数的jQuery回发页面。
- 我正在使用此更改的文本框值我的代码背后。
- I have server side textbox control with id:= txtFromDate. view state is enabled and its readonly.
- when page loaded for the first time i am setting current date value in above textbox.
- after that I change the value of textbox with jQuery.
- then posting back the page using jQuery with some __EVENTTARGET parameters.
- I am using this changed textbox value in my code behind.
我已经开发了带有1.1框架的Windows XP机器32位代码。但现在我把整个站点放在.NET 2.0应用程序池中的Windows Server 2008 R2版本(64位)上
I have developed code in window XP machine 32 bit with 1.1 framework. But now I have put entire site on windows server 2008 R2 edition (64bit) in .NET 2.0 application pool
问题:它可以正常工作开发机器。但在Windows Server 2008中,jQuery对文本框值的更改并未反映在代码背后。它保留了我在第一次加载页面时分配的旧值。
Problem: it works fine on development machine. but in windows server 2008 change in textbox value by jQuery is not being reflected in code behind. it retains old value which I assign when page gets loaded first time.
我想运行这个应用程序,因为它在我的开发机器上运行。
简而言之,我想在Windows Server 2008机器上的代码隐藏中更改textbox的值。
I want to run this application as it runs on my development machine. In short I want to get changed value of textbox in codebehind on windows server 2008 machine too.
谢谢。
推荐答案
我没有使用 txtFromDate.Text ,而是使用了 Request.Form [txtFromDate.ClientID] ,问题解决了。
Instead of using txtFromDate.Text I used Request.Form[txtFromDate.ClientID] and problem got solved.
这篇关于文本框值更改未反映在c#后面的代码中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!