Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.1
|
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 September 21st, 2004, 08:22 AM
Registered User
 
Join Date: Aug 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default postback, viewstate, tampering with values

Hi
i have a text box , after postback i want it to hold a different value to the one that was entered by the user. Is this possible?

i understand the area i want info on may be about manipulating the data in the viewstate collection

<asp:TextBox id="txtHeading" runat="server" Width="376px" EnableViewState="False"></asp:TextBox>

A
 
Old September 21st, 2004, 08:42 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Absolutely. Something like this:
----------------------------------------
If IsNumeric(txtHeading.Text) Then
    txtHeading.Text += 5
End If
----------------------------------------

Of course this is for a numeric value. If you want a string, date, etc. you will have to modify it accordingly.

J
 
Old September 21st, 2004, 11:45 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

You could put code in Page_Init and Page_Load, for when the page posts back.

Brian
 
Old September 21st, 2004, 11:29 PM
Authorized User
 
Join Date: Apr 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to sara_1981
Default

Hi,
yeah, you could put code in Init of page but you should attend that, when page is initualizing, your controls which is in this page is still not initualized and therefore if you want to change anything for instance the text of label in that, it couldn't know it.

Regards
Sara
 
Old September 22nd, 2004, 07:26 AM
Authorized User
 
Join Date: Jul 2004
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

BTW, why do you have EnableViewState = false.
I am pretty sure that's not what your want

 
Old September 22nd, 2004, 07:28 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

With EnableViewState="False", you would have to retain the value through another mechanism, such as the Page's ViewState, or the Cache or Session.

Brian





Similar Threads
Thread Thread Starter Forum Replies Last Post
textbox viewstate missing on postback JoshuaZ Classic ASP Basics 6 August 27th, 2008 03:45 PM
problem with viewstate and postback hertendreef ASP.NET 2.0 Professional 1 May 31st, 2008 04:05 PM
ViewState Wervis C# 1 December 3rd, 2005 11:35 AM
Viewstate Wervis BOOK: ASP.NET Website Programming Problem-Design-Solution 0 November 30th, 2005 09:42 AM
ViewState abdul_owiusa General .NET 0 October 18th, 2005 04:37 PM





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