Link to home
Start Free TrialLog in
Avatar of estanton
estanton

asked on

Gridview refresh on update.

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.
ASKER CERTIFIED SOLUTION
Avatar of asp_lha
asp_lha

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of estanton
estanton

ASKER

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.
I will be away from my computer until 4/2/07, but
I still need help.
If anyone is watching this post.. I am back and could really use the help.
I really need help.
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.
I figured it out. I have to call the datbind method during page prerender by overriding the prerender event.