日期:2014-05-18  浏览次数:20438 次

如何自定义弹出窗口
Protected Sub Wizardaccount_SideBarButtonClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.WizardNavigationEventArgs) Handles Wizardaccount.SideBarButtonClick

  Dim txtstep As String = CType(CType(e.NextStepIndex, Int16) + 1, String)
  Dim txtmsg As String = "您点击的SIDEBAR步骤项目为STEP" & txtstep & ",但系统不允许直接用sidebar局部切换步骤!"
  Dim mymsg As New alertmessage()
  mymsg.showmsg(Me.Page, txtmsg)
  e.Cancel = True

  End Sub



Dim mymsg As New alertmessage()这个语句报错,我是按照书上的实例输入的,但是那里错了呢?错误提示:未定义alertmessage()类型!

请各位高手给予指正,谢谢!

------解决方案--------------------
alertmessage不是标准的类,是自定义的,你需要先定义alertmessage类
------解决方案--------------------
按你的调用方法,至少需要定义下面这个类

VB.NET code
Public Class alertmessage
  Public Sub showmsg(page As System.Web.UI.Page, msg As String)
    page.ClientScript.RegisterStartupScript(page.GetType(), "js", "alert('" + msg.Replace("'", "\'").Replace(Environment.NewLine, "") + "')", True)
  End Sub
End Class