Wrox Programmer Forums
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 21st, 2004, 03:11 PM
Registered User
 
Join Date: Jan 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default View State -- Post Back

Hi All,
I'm having to work in an environment where several user controls are being loaded in a hirarchy. And the view state is being turned off. This is how it is supposed to be. I have a asp.net text box server control. I am not able to access the data typed into it on post back.
for ex: txtName.text returns an empty string. could not figure out how to get this working.

Any suggestions/ideas will be great.
Regards,
Avinash
 
Old January 21st, 2004, 03:34 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Viewstate shouldn't affect the text value of a textbox if you just entered data into it. It should only affect what events will fire. If the "OnChange" event is used for a textbox, it's likely that it will fire on every postback if the viewstate for the textbox wasn't working. There must be something else wrong. Does the value of the textbox stay in it between postbacks?

Peter
------------------------------------------------------
Work smarter, not harder.
 
Old January 21st, 2004, 03:41 PM
Registered User
 
Join Date: Jan 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Peter,
Heres what it is. I have other form elements on the same page (may or may not be on the same user control). One of them causes a post back. either via a button or something like that. or for that matter may be a comobo set to AudoPostBack=true.
The crazy thing is that suppose I enter 5 into this txtbox and have it post back. And on the form load event do a respone.write(txtDuh.txt) it is blank. Howvere when the page is loaded the subsequent times what ever was typed into the txtbox is still retained....dunno why its happening.
Thanks Avinash
 
Old January 21st, 2004, 03:51 PM
Registered User
 
Join Date: Jan 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

PS: Also if i do a respone.write(request.form) I can see the posted variable with the value. Just that the server side handle to it is failing...
 
Old January 21st, 2004, 04:48 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

This is happening only on the FIRST postback?
Like this:?
Page hit 1 (postback -): Enter value (5), post.
Page hit 2 (postback 1): "5" is gone. Enter "10", post.
Page hit 3 (postback 2): "10" is there?

This problem is beginning to sound strangely familiar to something I encountered once. Are any of the controls (user/server) being moved around on the page? Turn on tracing for the page, get the first page hit and look at the control tree. Then do the first postback and check the control tree again. Compare the two. If they are different (for whatever reason) that would explain why the value is not being retained. Each subsequent page (posted back) control tree should look the same.

Peter
------------------------------------------------------
Work smarter, not harder.
 
Old January 21st, 2004, 05:30 PM
Registered User
 
Join Date: Jan 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Peter.
Got it sorted. Kind of feel dumb about the problem. Had to do with the controls being loaded dynamically in the load event. It works when its done in the init event. Pretty obvious....But had overlooked a small piece of code..

Thanks Again.
Regards,
Avinash





Similar Threads
Thread Thread Starter Forum Replies Last Post
View state problem rabbit3 ASP.NET 2.0 Professional 0 October 23rd, 2007 08:55 PM
Javascript and View State VictorVictor ASP.NET 2.0 Professional 8 April 2nd, 2007 02:34 PM
Post Back rngrmn VB.NET 2002/2003 Basics 2 April 6th, 2006 01:14 PM
Session State|View State|Do I have other options? rockon ASP.NET 1.x and 2.0 Application Design 2 October 5th, 2005 07:10 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.