 |
| 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
|
|
|
|

September 21st, 2004, 08:22 AM
|
|
Registered User
|
|
Join Date: Aug 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

September 21st, 2004, 08:42 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
|
|
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
|
|

September 21st, 2004, 11:45 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Hey,
You could put code in Page_Init and Page_Load, for when the page posts back.
Brian
|
|

September 21st, 2004, 11:29 PM
|
|
Authorized User
|
|
Join Date: Apr 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

September 22nd, 2004, 07:26 AM
|
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
BTW, why do you have EnableViewState = false.
I am pretty sure that's not what your want
|
|

September 22nd, 2004, 07:28 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
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
|
|
 |