Solved

Re-load an ASP.Net page

Posted on 2007-03-27
1
163 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Login 17 51
Media.Imaging 1 18
how to convert MM/dd/YYYY hh:mm:ss AM to YYYY-MM-dd datetime format by linq? 4 59
Simple Injector with Web Service 4 43
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

831 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