Solved

Gridview refresh on update.

Posted on 2007-03-28
7
520 Views
Last Modified: 2008-01-09
I am using visual studio 2005 standard. I created a gridview that uses an sqldatasource who's select query uses a text box (a contract number) on the page as a parameter. I have a button that runs the update query in the sqldatasource, and I have a button that runs an update based on a text box on the page.
The page display is based on the contract number text box. In order to get the contract number to perpetuate after the update I use " Response.Redirect("Default.aspx?thecontract=" & TheContractID.Text & "", False) ".
The problem is the gridview does not refesh. In fact it does not even show up. The contract number text box's autopostback is set to true.
I need to get the gridview to refresh when the page loads, or the update is run.
0
Comment
Question by:estanton
  • 6
7 Comments
 
LVL 5

Accepted Solution

by:
asp_lha earned 500 total points
ID: 18808576
try to do  GridView1.DataBind() after update
0
 

Author Comment

by:estanton
ID: 18808708
That did not work. I tried it in the sqldatasource's updating event, and also in the " GridView1_SelectedIndexChanged " sub that calls an update function.
0
 

Author Comment

by:estanton
ID: 18812286
I will be away from my computer until 4/2/07, but
I still need help.
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:estanton
ID: 18837701
If anyone is watching this post.. I am back and could really use the help.
0
 

Author Comment

by:estanton
ID: 18839325
I really need help.
0
 

Author Comment

by:estanton
ID: 18839854
Maybe I shoul d change my quesiton a bit. I have a gridveiw that uses a text box's value as a paramteter in the select query. When I load the page, passing the text box's value in the url  ( Default.aspx?textboxvar=5555555 ) the gridview does not load. I collect the variable and populate the text box, but the gridveiw does not show up. I tried putting using gridview1.databind in the Page_Load event, but it doe not work.
If I change the text in the text box the, the gridview will load. I presume this is because I have the autopost back property set to true.
0
 

Author Comment

by:estanton
ID: 18860644
I figured it out. I have to call the datbind method during page prerender by overriding the prerender event.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

759 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

21 Experts available now in Live!

Get 1:1 Help Now