Solved

Re-load an ASP.Net page

Posted on 2007-03-27
1
162 Views
Last Modified: 2010-04-16
I have two gridviews on an ASP.Net page. Each grid contains the same data, the difference being that the top grid has the data in Field1 set to 1 for each record, and the data in Field1 on grid 2 set to 0. I have a button on each grid for each record. It changes the value of Field1 to 1 or 0, depending on which grid you are using. All of this works, the problem is that when, for example, I click the button next to a record in grid 1, which changes its value to 0, the record goes away, but does not move to grid2. I have to navigate back to the page to see the change reflected. So I think I need a way for the page to re-load after every click. How can I do this? Also, the app is written in C#, but this particular page has no code-behind, as I just used the drag ad drop features of VS 2005 to build this page. Thanks for any help!
0
Comment
Question by:dodgerfan
1 Comment
 
LVL 1

Accepted Solution

by:
Reactor earned 500 total points
ID: 18828166
Hi Dodgerfan,

The answer will be setting EnableViewstate =false for both grids.

The Viewstate is designed to persist attributes of controls between round-trips to the server. If, say, you change the colour of a Label in some code, veiwstate should remember this everytime the page loads so that you do not have to repeat the code in every Page_Load event. This is that big hidden, encrypted field called _VIEWSTATE that you will see at the top of the generated HTML if you right click your page when it is running and select "view source" Setting EnableviewState to false just makes the application exclude your two grids from that functionality.

The downside of using EnableViewState=false is simply that any other changes to the attributes of the grids at run-time (in code) will not be "remembered" and will have to be re-set each time. Not a serious drawback though. I work for a high profile financial institution and we never use viewstate unless it is 100% essential as there are some security concerns about using it as well. Nothing serious but it does give a bit of info to would be attackers that is not necessary to divulge.

I hope this has been of help to you, thanks for the points, I really appreciate it. I get as much out of answering questions as I do asking them. I end up researching and learning a lot myself. I will be keen to see your website when it is complete (not that a South African would know anything about baseball)

Chat soon,

Reactor
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now