I have a page with a Gridview and FormView and a button which uploads an image file to a folder, (the FormView contains the file as an image).
The ButtonClick satisfactorily uploads the file, but a viewer has to refresh the page to see the new picture, which is not what I expect them to have to do.
here is the code that renames the file and saves it, after some previous code has uploaded it from a viewers drive... it also tries using response.redirect, but this merely opens a new page at the first record of the FormView:
Code:
Public Sub SaveFile2(ByVal FileUp As FileUpload)
Dim fileName1 As String = String.Format("{0}.jpg", FormView1.DataKey.Value)
Dim filePath1 As String = Server.MapPath("~/Dogimages/" & fileName1)
FileUp.SaveAs(filePath1)
Response.Redirect("Dogsdata.aspx#formview")
End Sub
What could I use to refresh the page to renew the image, and open the new page at the record with the new image?
The Formview1.Datakey.Value is the PrimaryKey ID of the record, so if I could capture that and use it to somehow make the page open at the record with that ID, that would be a solution... I just dont know how to do it.
I'm flying by the seat of my pants here, so detailed explanation would be appreciated.
Many Thanks
Richard