W
Wayne Wengert
I am attempting to incorporate some techniques I found in an MSDN article
into one of my aspx pages. It basically adds a new class that Inherits from
the System.Web.UI.Page and includes some new subs and function (some are
shown below). I have a page based on that new class and in my code where a
user clicks on a Save button (saves data to my DB) I want to display an
alert message. I get the error indicated below when I run the page - I
assume it has to do with the onclick event which calls sub in the base
class? How should this be coded?
Wayne
============= Error Information ============
Compiler Error Message: BC30201: Expression expected.
Source Error:
Line 30: <asp:textbox id="txtMisc" style="Z-INDEX: 117; LEFT: 133px;
POSITION: absolute; TOP: 497px" runat="server"
Line 31: Width="475px" Height="56px" MaxLength="200"
TextMode="MultiLine" Rows="2"></asp:textbox>
Line 32: <asp:button id="btnSave" style="Z-INDEX: 118; LEFT: 159px;
POSITION: absolute; TOP: 564px" runat="server"
Line 33: Width="100px" Height="29px" onclick="DisplayAlert('The
information has been added to the database!')" Text="Save &
Exit"></asp:button>
Line 34: <asp:button id="btnCancel" style="Z-INDEX: 119; LEFT: 348px;
POSITION: absolute; TOP: 565px"
============= In Class Inherited ==============
Public Sub DisplayAlert(ByVal message As String)
RegisterClientScriptBlock(Guid.NewGuid().ToString(), _
"<script language=""JavaScript"">" & GetAlertScript(message) & "</script>")
End Sub
Public Function GetAlertScript(ByVal message As String) As String
Return "alert('" & message.Replace("'", "\'") & "');"
End Function
into one of my aspx pages. It basically adds a new class that Inherits from
the System.Web.UI.Page and includes some new subs and function (some are
shown below). I have a page based on that new class and in my code where a
user clicks on a Save button (saves data to my DB) I want to display an
alert message. I get the error indicated below when I run the page - I
assume it has to do with the onclick event which calls sub in the base
class? How should this be coded?
Wayne
============= Error Information ============
Compiler Error Message: BC30201: Expression expected.
Source Error:
Line 30: <asp:textbox id="txtMisc" style="Z-INDEX: 117; LEFT: 133px;
POSITION: absolute; TOP: 497px" runat="server"
Line 31: Width="475px" Height="56px" MaxLength="200"
TextMode="MultiLine" Rows="2"></asp:textbox>
Line 32: <asp:button id="btnSave" style="Z-INDEX: 118; LEFT: 159px;
POSITION: absolute; TOP: 564px" runat="server"
Line 33: Width="100px" Height="29px" onclick="DisplayAlert('The
information has been added to the database!')" Text="Save &
Exit"></asp:button>
Line 34: <asp:button id="btnCancel" style="Z-INDEX: 119; LEFT: 348px;
POSITION: absolute; TOP: 565px"
============= In Class Inherited ==============
Public Sub DisplayAlert(ByVal message As String)
RegisterClientScriptBlock(Guid.NewGuid().ToString(), _
"<script language=""JavaScript"">" & GetAlertScript(message) & "</script>")
End Sub
Public Function GetAlertScript(ByVal message As String) As String
Return "alert('" & message.Replace("'", "\'") & "');"
End Function