textbox value change not being reflected in code behind c#

Dharmesh picture Dharmesh · Feb 13, 2013 · Viewed 10k times · Source

I am using .NET framework 1.1 with C#. My problem description is given below.

  1. I have server side textbox control with id:= txtFromDate. view state is enabled and its readonly.
  2. when page loaded for the first time i am setting current date value in above textbox.
  3. after that I change the value of textbox with jQuery.
  4. then posting back the page using jQuery with some __EVENTTARGET parameters.
  5. I am using this changed textbox value in my code behind.

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

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.

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.

Thanks.

Answer

Dharmesh picture Dharmesh · Feb 21, 2013

Instead of using txtFromDate.Text I used Request.Form[txtFromDate.ClientID] and problem got solved.