Hello,
I'm using ASP.NET with VB.
I'm filling a datagrid with image files. In case one file is already located on the server, I want to send a confirm message. This message warns the user that the file will be replaced if OK is selected. Otherwise I'm doing nothing.
I have an hidden text field that containins the confirm return value. I'm also using the OnServerChange event to catch this value through my VB code. But the event does not fire when the hidden field value is changed. It's fired next time I click on the cmdUpload submit button.
Here's my code:
Protected WithEvents hidden1 As System.Web.UI.HtmlControls.HtmlInputHidden
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
hidden1.EnableViewState = True
End Sub
Public Sub Add_Image(ByVal sender As System.Object, ByVal e As System.EventArgs)
Select Case Exist
Case True
'if the file already exists, pop up a warning message
lblMsg.Text = "<SCRIPT language = 'javascript'>a = confirm('This file already exists');document.Form1.hidden1.value=a;</SCRIPT>"
...
End Sub
Public Sub hidden1_ServerChange(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hidden1.ServerChange
End Sub
<asp:button id="cmdUpload" onclick="Add_Image" runat="server" Text="Add...">
<input id="hidden1" type="hidden" name ="hidden1" runat="server" onchange ="test();" onserverchange ="hidden1_ServerChange">
How can I get back the confirm user choice within my VB code ?
I'm using ASP.NET with VB.
I'm filling a datagrid with image files. In case one file is already located on the server, I want to send a confirm message. This message warns the user that the file will be replaced if OK is selected. Otherwise I'm doing nothing.
I have an hidden text field that containins the confirm return value. I'm also using the OnServerChange event to catch this value through my VB code. But the event does not fire when the hidden field value is changed. It's fired next time I click on the cmdUpload submit button.
Here's my code:
Protected WithEvents hidden1 As System.Web.UI.HtmlControls.HtmlInputHidden
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
hidden1.EnableViewState = True
End Sub
Public Sub Add_Image(ByVal sender As System.Object, ByVal e As System.EventArgs)
Select Case Exist
Case True
'if the file already exists, pop up a warning message
lblMsg.Text = "<SCRIPT language = 'javascript'>a = confirm('This file already exists');document.Form1.hidden1.value=a;</SCRIPT>"
...
End Sub
Public Sub hidden1_ServerChange(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hidden1.ServerChange
End Sub
<asp:button id="cmdUpload" onclick="Add_Image" runat="server" Text="Add...">
<input id="hidden1" type="hidden" name ="hidden1" runat="server" onchange ="test();" onserverchange ="hidden1_ServerChange">
How can I get back the confirm user choice within my VB code ?