How do I get a Gridview to refresh the data shown on the webpage,
as is done,
when a page is selected and AllowPaging="True"?
I have used:
SqlDataSource1.DataBind();
GridView1.DataBind();
They DO NOT bring up the updated value from the underlying SQL table.
The only way I can get the new value is to exit and reenter the webpage or
toggle the Pages, throught the "AllowPaging".
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
Instead of rebuilding the connection from scratch.
(Which I am not sure I could convert my SQLdatasource to your hardcoded connection)
How would I disconnect the grid and datasource, then reconnect them.
Thereby refreshing the CNT column on the grid.
Thanks
<asp:SqlDataSource ID="SqlDataSource1" runat="server" EnableCaching="false" ConnectionString="<%$ ConnectionStrings:CS1 %>" SelectCommand="SELECT [id], [term], [url], [cnt] FROM [gogetit] ORDER BY [createdate] DESC"> </asp:SqlDataSource>
Update: I have simplified the code, and found that whenever I clcik a button or go to another page, it stops any further display update of the CNT column.
As long as I keep clicking the URL it will incremen the counter, but as soon as I click a button or page then it stops the update of the CNT column.
AndyPandy
ASKER
Update: Response.Redirect(url_temp,false); is causing the problem.
When commented out, everthing works fine.
Why is this?
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
AndyPandy
ASKER
Not quite what I was looking for.
Turns out I need ato understand how/why of Response.Redirect(url_temp,false); changing the viewstate
Instead of rebuilding the connection from scratch.
(Which I am not sure I could convert my SQLdatasource to your hardcoded connection)
How would I disconnect the grid and datasource, then reconnect them.
Thereby refreshing the CNT column on the grid.
Thanks
Open in new window