I want to attached a Javascript in File control button. I want to use Javascript script to display a message on label control before file is uploading to the server. However, it doesn't work. Any idea ? Is there a way to debug the logic in Javascript ??
<asp:Label
id="lblMessage"
Runat="server" EnableViewState="False" Font-Bold="true" />
Protected Sub btnAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAdd.Click
Dim ScriptStr As String
'ScriptStr = "<script language=""JavaScript"">" & _
' "alert(""Upload in progress..."")" & _
' "</script>"
ScriptStr = "<script language=""JavaScript"">" & _
"document.GetElementById("
"lblMessag
e"")" & _
" = ""Uploading..."" </script>"
ClientScript.RegisterStart
upScript(M
e.GetType,
"test", ScriptStr)
'Upload file
If Not FolderWriteAccess() Then
Exit Sub
End If
If (upFile.HasFile) Then
' btnAdd.Attributes.Add("OnC
lick", "test")
Try
Dim filePath As String = strDirs.Text & "/" & upFile.FileName
upFile.SaveAs(filePath)
BindGridV(strDirs.Text)
' Me.ShowSucessMsg("File has been added succesfully !!!")
Catch ex As Exception
Me.ShowFailMsg(ex.Message)
End Try
End If
End Sub
Start Free Trial