Solved

Re-load an ASP.Net page

Posted on 2007-03-27
1
161 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
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

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…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 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

12 Experts available now in Live!

Get 1:1 Help Now