Last post Aug 06, 2008 04:48 AM by shailesh_thapa
Jul 20, 2008 03:39 AM|polynaux|LINK
I placed my FileUpload in my MyGridView update template and on
MyGridView.RowUpdating I want to
get the image name + user name to create the saving path, just like this:
If FileUpload.FileName.ToString = "" Then
Dim ImagePath As String = "Null"
Dim ImagePath As String = FileUpload.FileName.ToString
' Construct saving path
System.IO.Directory.CreateDirectory(Server.MapPath("~/m/p/" + objGuidUserID.ToString + "/G/" + NameTextBox.Text))
Dim strImagePath As String = (Server.MapPath("~/m/p/" + objGuidUserID.ToString + "/G/" + NameTextBox.Text + "/" + FileUpload.FileName.ToString)) 'IO.Path.Combine(strImageFolderPath, strPictureName)
' Upload image
Catch ex As Exception
Jul 20, 2008 04:00 AM|farazsk11|LINK
I assume that you are trying to write the code on Row_Updating event of GridView. You can try this
now you can use fc to use the methods and properties. If you want to directly use the control you can try this
DirectCast(Me.gvItems.Rows(e.RowIndex).FindControl("FileUploadControl1"), FileUpload).FileName ... you can also use other methods and properties like this.
Hope it will help you out.
Jul 20, 2008 04:46 AM|polynaux|LINK
many thanks farazsk11 !
Aug 06, 2008 04:48 AM|shailesh_thapa|LINK
i have detailsview in update panel and fileuploader in detailsview which is working fine as i have used trigger postback property for fileuploading ,now when i am uploading file then no problem
but when i edit the uploaded file and dont upload any file then my uploaded imagename in database go to blank means blank is inserted in place of my imagename field in database when not uploading any image.
my code is like this Detailsview_Itemupdating()
what is the problem in it,i have searched google and all forums can any one have done that then please give me the solution
if someone has done that with or without update panel then plz give the reply