Solved

Gridview refresh on update.

Posted on 2007-03-28
7
523 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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

765 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