473,397 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

use ViewState

here is a case:
a page has two textboxs and a button, when Page_Load, the two
textboxs was set a value. and when user click the button, if the values
of the two textboxs was not changed, it will show the alert "there is
not any change". How to use the ViewState to do this?
many thanks !
( I'm a new comer of Google Groups, and my English isn't very well,
hope to get help!)

Aug 20 '06 #1
3 1488
mythcui,
this is really an ASP.NET question and should have been posted to the
ASP.NET group.
Normally one would not use ViewState for this purpose. You would have code
to handle the TextChanged event of each TextBox and in this you would have
your logic that determines whether to show an alert. If you want a
client-side alert dialog, you can emit client script such as
Response.Write("<script>alert('" +yourmessage+"');</script>");

Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"my*****@gmail.com" wrote:
here is a case:
a page has two textboxs and a button, when Page_Load, the two
textboxs was set a value. and when user click the button, if the values
of the two textboxs was not changed, it will show the alert "there is
not any change". How to use the ViewState to do this?
many thanks !
( I'm a new comer of Google Groups, and my English isn't very well,
hope to get help!)

Aug 20 '06 #2
Use session state could be easier.
http://msdn2.microsoft.com/en-us/library/ms178581.aspx

chanmm

<my*****@gmail.comwrote in message
news:11*********************@75g2000cwc.googlegrou ps.com...
here is a case:
a page has two textboxs and a button, when Page_Load, the two
textboxs was set a value. and when user click the button, if the values
of the two textboxs was not changed, it will show the alert "there is
not any change". How to use the ViewState to do this?
many thanks !
( I'm a new comer of Google Groups, and my English isn't very well,
hope to get help!)

Aug 20 '06 #3

Peter 写道:
mythcui,
this is really an ASP.NET question and should have been posted to the
ASP.NET group.
Normally one would not use ViewState for this purpose. You would have code
to handle the TextChanged event of each TextBox and in this you would have
your logic that determines whether to show an alert. If you want a
client-side alert dialog, you can emit client script such as
Response.Write("<script>alert('" +yourmessage+"');</script>");

Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"my*****@gmail.com" wrote:
here is a case:
a page has two textboxs and a button, when Page_Load, the two
textboxs was set a value. and when user click the button, if the values
of the two textboxs was not changed, it will show the alert "there is
not any change". How to use the ViewState to do this?
many thanks !
( I'm a new comer of Google Groups, and my English isn't very well,
hope to get help!)
Thanks, and I have resolved it.~~~
Best Regards.

Aug 22 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: John Kirksey | last post by:
I have a page that uses an in-place editable DataGrid that supports sorting and paging. EnableViewState is turned ON. At the top of the page are several search fields that allow the user to filter...
3
by: Steve Drake | last post by:
All, I have a CONTROL that contains 1 control (Control ONE), the 1 control that it can contain 1 or 2 control (Control A and B). Control A, raises and event and Control ONE receives this event...
10
by: neo | last post by:
hi, I am studying ASP.NET and have few questions - 1) The session ID and values of controls is stored in VIEWSTATE variable. So now when we put EnableViewState="false" in Page directive and...
1
by: Simon | last post by:
Hi everyone, I have a quick question that I hope someone can help me with: I've made a user control that contains a text box and some validation functionality. This control has a few extra...
7
by: et | last post by:
I'm not sure I understand the use of the ViewState. Do I understand correctly that values of controls are automatically held in a hidden control called ViewState? If so, then why can't we get...
3
by: RCS | last post by:
I have an app that I have different "sections" that I want to switch back and forth from, all while having the server maintain viewstate for each page. In other words, when I am on Page1.aspx and...
9
by: Mark Broadbent | last post by:
Been a while since I've touched asp.net but one thing that always seems to fustrate me is the loss of state on variable declarations. Is there anyway (i.e. assigning an attribute etc) to instruct...
6
by: hitendra15 | last post by:
Hi I have created web user control which has Repeater control and Linkbutton in ItemTemplate of repeater control, following is the code for this control On first load it runs fine but when...
6
by: paul.hester | last post by:
Hi all, Does anyone know why the ViewState would be empty? When I'm receiving a postback, I can access a posted value using controlName.Value but not ViewState. I have EnableViewState set...
12
by: Nick C | last post by:
Hi How can i reduce the viewstate for my asp.net application. It is getting very large now. What is a good solution? thanks N
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.