views:

113

answers:

5
A: 

Try to step through this code with the debugger. See if there is a spelling mistake.

Yossi
A: 

Make sure you aren't setting txtVendorName.Text to blank in your Load or PreRender events without checking for ispostback

bechbd
A: 

When is this code being called? In an event on a button?

It's important to remember the ASP.NET page life cycle.

http://msdn.microsoft.com/en-us/library/ms178472.aspx

http://www.15seconds.com/Issue/020102.htm

If you are calling it in an event on the button, you may be setting it to blank somewhere earlier in the cycle. If you are doing it in page_load, use if (!Page.IsPostBack){} where you set it to blank, that way it will only blank it out the first time the page is loaded, and not right before you want to use it in the button event!

RodH257
tried if(!Page.IsPostBack) and does not work;
user279521
although something weird is happening. When I created a code block if(!Page.IsPOstBack) and put a breakpoint inside that code block, then build the project and run it, the breakpoint is triggered when I hit F5.
user279521
A: 

Are you dynamically creating your textboxes? If so, be sure you're doing so in the init, page lifecycle is a bit finicky and could cause your textboxes to have problems if you create them after the init(which is when controls are registered).

Mike Cellini
nope, no dynamic textboxes here;
user279521
A: 

Ok, setting the PostBackURL property of the submit button to the PageABC.aspx resolved that issue. Anyone know how and why the postbackurl property would resolve something like this?

user279521
Thanks for providing the answer.
I had been trying to resolve this for the past to days. Thanks
DotNetRookie