Last post Feb 27, 2015 01:07 PM by Carthalion
Feb 26, 2015 01:33 PM|Carthalion|LINK
This is with ASP.NET VB. I use a message box and Exit Sub to stop a calculation with missing data.
Public Sub MsgBox(ByVal Message As String)
System.Web.HttpContext.Current.Response.Write("alert(""" & Message & """)" & vbCrLf)
If Val(txtSalesPrice.Text) = 0 Or Val(txtIntRate.Text) = 0 Then
MsgBox("Please enter a sales price and an interest rate.")
This works until I add an Update Panel. Then neither the message box or the Exit Sub work inside the Update Panel.
Any ideas about this?
Feb 26, 2015 01:45 PM|PatriceSc|LINK
To know why Exit Sub doesn't produce the effect you want we would need to know where it is. Exit Sub just exists the current method. The rest of the page is still rendered. Depending on what you replace here, an update panel may not be the best approach.
If you want to keep the Update Panel approach you would have liekly to wrap this code Inside a js function and to call explicitely this function from your client side code when the panel has been retrieved (basically creating a kind of "onload" event for
the panel rather than for the whole page).
Feb 27, 2015 01:07 PM|Carthalion|LINK
Great information. Thank you!