Hello Everyone,
I am getting stuck inside this problem,
Here is my simple application using Master Page Concept and created one simple Page. which contains AsyncFileUpload Control and Submit Button
Code Page :
Partial Class Pages_ArtWork_UploadImages
Inherits BasePage
Public imgFilePath As String = Nothing
.....
Protected Sub imgFileUpload_UploadedComplete(ByVal sender As Object, ByVal e As AjaxControlToolkit.AsyncFileUploadEventArgs)
System.Threading.Thread.Sleep(1500)
If imgFileUpload.HasFile Then
If checkFileType(System.IO.Path.GetExtension(e.filename)) Then
Dim UploadedImage As System.Drawing.Image = System.Drawing.Image.FromStream(imgFileUpload.PostedFile.InputStream)
If UploadedImage.PhysicalDimension.Width > 250 OrElse UploadedImage.PhysicalDimension.Height > 250 Then
Dim alert As String = ("alert('Image size should be exactly 250*250 dimension. Your Current Image width is " + UploadedImage.PhysicalDimension.Width.ToString + " and height is " + UploadedImage.PhysicalDimension.Height.ToString + ".');")
ScriptManager.RegisterStartupScript(Me, [GetType](), "JScript", alert, True)
Else
imgFilePath = Server.MapPath("../../Uploads/Images/") + (ddl_EditHw.SelectedValue & System.IO.Path.GetExtension(e.filename))
imgFileUpload.SaveAs(imgFilePath)
lblResult.Visible = False
ScriptManager.RegisterClientScriptBlock(Me, Me.GetType(), "Script", "alert('File Uploaded Successfully');", True)
End If
Else
ScriptManager.RegisterClientScriptBlock(Me, Me.GetType(), "Script", "alert('Uploading Failed - Check File Type (.jpg, .png, .gif, .jpeg)');", True)
End If
End If
ClearContents(sender)
End Sub
Public Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
If Not imgFilePath = Nothing Then
....
...
Else
lblResult.Text = "Please Upload Image first."
lblResult.Visible = True
End If
In above submit click event , when I try to get Image File path from imgFilePath variable. It returns "Nothing". If I use same variable inside other functions It works perfectly. but dont know what is problem with Click event.
Waiting for your kind reply.
Thanking You
Regards :
Rohit More