I have a massive page that is almost all dynamically created in the code behind page VB.net. I am having trouble getting error messages to popup.
I have a error message that fires in the load event that does work but anytime I try to show a error message after the page has been rendered it never shows.
I have dynamically created buttons that i use to run a function to save user entered data to a sql database. I have a generic button click event that I use to evaluate which button was clicked so I update the correct data. The error messages are if the update fails or if the user enters the incorrect data type.
These are the two ways I have tried to show the errors. Keep in mind that I use both of these on other pages without issue and the first one is the one that works correctly on the load event of this page.
' Define the name and type of the client scripts on the page.
Dim csname1 As String = "PopupScript"
Dim cstype As Type = Me.GetType()
' Get a ClientScriptManager reference from the Page class.
Dim cs As ClientScriptManager = Page.ClientScript
' Check to see if the startup script is already registered.
If (Not cs.IsStartupScriptRegistered(cstype, csname1)) Then
Dim cstext1 As String = "alert('Unable to the update on the record.');"
cs.RegisterStartupScript(cstype, csname1, cstext1, True)
ScriptManager.RegisterClientScriptBlock(Me.Page, GetType(Page), "clientScript", "alert('" & strreturn & "')", True)
I can only assume that this is some post back issue however I'm not sure what to do about it.