• 0

ASP.NET - Gridview not refreshing on Postback


Question

Guys,

I have this web app that I am developing that is my first project using ASP.NET 2.0, so I am learning a lot as I go. I have run into a particular issue that I am not sure how to best fix. Here is the deal:

On a particular page I have 2 Gridview Controls. Gridview1 shows a list of features an item has, and GridView2 shows a list of features available. Each Gridview control has a template column with checkboxes. In Addition, there a button associated with Gridview1, that when pressed, will remove the checked features from the item. GridView2 has a button for it that will add the checked features to the item. I have all my logic functioning properly, and things are properly assigned and removed, but I can only see this if I navigate away from the page and then come back. These changes are not reflected in the postback when I press either button.

This brings me to my question, what is the best way I can make these Gridview's refresh their data on postback? If it matters, the gridviews are receiving their data from an ObjectDataSource and a custom method that returns a class which extends / implements BaseCollection.

Thanks in advance for any help you can give me!

3 answers to this question

Recommended Posts

  • 0
I just answered my own question. For those interested, I set the EnableViewState property on the ObjectDataSource to false and this solved my problem. Thanks for looking.

There must be something else going on. Disabling ViewState generally for databinding controls is not a good thing.

As stewright said, calling the DataBind method will refresh it.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Been using Outlook all my Life on Windows,  But Classic Outlook---Briefly Tried NEW Outlook, but wasn't to my tastes, but i feel if and when forced to switch in the future--i could get used to it if  i had to   
    • Apple has clarified Series 9 was left off the watchOS 27 compatibility list by mistake.
    • Signal accuses UK government of using child safety as cover for mass surveillance by David Uzondu Recently, the UK's Home Office announced a sweeping set of proposals to make Britain the "first country in the world" where children cannot share or view nude photos on their smart devices, an initiative that authorities claim will protect children from online predators and combat pornography. In response, Signal believes that while the government must keep children "safe" and "protected," it should do so through social services and education, not by "surveillance, funding cuts, and cover-ups." The company called the plan "dystopian" and warned that it violates everyone's fundamental right to privacy, arguing that scanning on the presumption of nudity will only strengthen the market dominance and data control of giant corporations like Apple and Google. The statement continues by accusing the government of hiding its true intentions under the guise of child safety. Signal argues that the Home Office is building an invisible surveillance infrastructure that remains ripe for exploitation by future administrations and authoritarian regimes. According to the company, this aggressive approach completely ignores the actual needs of young people, such as properly funded schools and mental health services. Tech companies like Apple and Google have a three-month window to implement these mandatory device-level filters across the United Kingdom. If these tech firms refuse to comply with the mandate, the government will pass emergency legislation to force them to comply, threatening massive fines and even going after the CEOs of these companies with criminal charges. The technology will work by blocking explicit images directly on the operating system of all smartphones and tablets by default. This system monitors the device camera and third-party apps to intercept nudity before anyone can upload or send the image. Adults can still view explicit content, but only after completing a strict age verification check to unlock their devices. Several bodies like the NSPCC and Barnardo's praised the Home Office's decision, arguing that device-level intervention stops the cycle of grooming before it starts. The Internet Watch Foundation (IWF) also supported the policy, claiming that tech companies can implement on-device checks "without threatening privacy or collecting any data."
    • Did you watch the keynote? It is way beyond what is described in this article. Looks interesting. Now it is time for them to deliver unlike what happened in 24.
    • It pretty much has to be compatible with MS Office or it is going nowhere. The rest of the world runs office including Europe. If it is not compatible it will not survive.
  • Recent Achievements

    • Very Popular
      Captain_Eric earned a badge
      Very Popular
    • One Month Later
      amusc earned a badge
      One Month Later
    • One Month Later
      DJC50PLUS earned a badge
      One Month Later
    • Week One Done
      DJC50PLUS earned a badge
      Week One Done
    • Proficient
      Eric Biran went up a rank
      Proficient
  • Popular Contributors

    1. 1
      +primortal
      510
    2. 2
      PsYcHoKiLLa
      226
    3. 3
      ATLien_0
      87
    4. 4
      +Edouard
      83
    5. 5
      Steven P.
      81
  • Tell a friend

    Love Neowin? Tell a friend!