Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 1st, 2006, 07:35 PM
Registered User
 
Join Date: Sep 2006
Location: Cranston, RI, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Gridview Update Issue

Hello all,

 I have a web page that has a standard gridview control using an accessdatasource to pull all records from a database table. I have also added a custom hyperlink field that redirects the user to another page using the following datanavigateurlformatstring:" ~/Private/Applications/Parts-Ordering/Admin/Manage.aspx?RequestID={0}"

This all works as expected and the new page opens and populates some text boxes by querying the DB for the row containing RequestID. Now here is where I have a problem. I have a button named delete that calls some code that deletes the DB row containing RequestID. The code is listed below. The delete command works as expected but when the code processes the "Response.Redirect(http://wintelservices/Private/Applic...x?App=Requests)", I am taken back to the main page containg my gridview. The row with the RequestID is still in the gridview. If I press F5 a few times, it eventually disappears. I have tried disabling page cache and set the cachduration for the accessdatasource to 1 second, but it still happens every time. Any help would be appreciated. I assume that the server is caching the accessdatasource results but no matter what I change, the value still shows up. Thank you in advance.


Protected Sub btnDelete_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDelete.Click

Dim strConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _

"Data Source=D:\Inetpub\wwwroot\Private\Data\Parts-Tracking.mdb;"



Dim objConnection As New OleDbConnection(strConnectionString)

Dim objCommand As New OleDbCommand("usp_DeleteRequestByID", objConnection)

objConnection.Open()

objCommand.CommandType = CommandType.StoredProcedure

objCommand.Parameters.Add(New OleDbParameter("@REQUESTID", Page.Request.QueryString("REQUESTID").ToString))



If objCommand.ExecuteNonQuery() = 1 Then




Response.Redirect("http://wintelservices/Private/Applications/Parts-Ordering/Admin/Admin.aspx?App=Requests")

Else


Response.Write("There was an error deleting your request. Please try again.")

End If


End Sub


Jim Gregg




Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't get GridView to update xr280xr ASP.NET 2.0 Professional 5 February 15th, 2008 12:45 PM
Events issue for programatically created GridView VadimZ ASP.NET 2.0 Professional 4 July 5th, 2007 05:11 PM
Gridview using Update *only* pbranumfl ASP.NET 2.0 Basics 2 December 4th, 2006 03:21 PM
Gridview - EditItemTemplate DropDownList issue Break40 ASP.NET 2.0 Basics 0 June 21st, 2006 08:43 AM
Gridview & DetailsView Database Image Issue ayadrocks ASP.NET 2.0 Basics 1 December 27th, 2005 05:50 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.