Advertisement
5_2007-2008 Math #177114

ASP.NET Popup Windows

Show any Page as a modal popup window in ASP.NET.

AI

Ringkasan AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Kode Sumber
original-source
Public Function BuildPopUpScript(ByVal Page As String, _
                    Optional ByVal dialogWidth As Int32 = 255, _
                    Optional ByVal dialogHeight As Int32 = 255, _
                    Optional ByVal modal As Boolean = True) As String
    Try
      Dim jsmodal As String
      If modal Then
        jsmodal &= "if (window.showModalDialog)"
        jsmodal &= "{window.showModalDialog('" & Page.Trim & "','name',"
        jsmodal &= "'dialogWidth:" & dialogWidth & "px;dialogHeight:" & dialogHeight & "px;status:no;help:no;scroll:no');}"
        jsmodal &= "else{"
        jsmodal &= "window.open('" & Page.Trim & "','name','height=" & dialogHeight & ","
        jsmodal &= "width=" & dialogWidth & ",toolbar=no,directories=no,status=no,"
        jsmodal &= "menubar=no,scrollbars=no,resizable=no,modal=yes');"
        jsmodal &= "}"
      Else
        jsmodal &= "window.open('" & Page.Trim & "','name','height=" & dialogHeight & ","
        jsmodal &= "width=" & dialogWidth & ",toolbar=no,directories=no,status=no,"
        jsmodal &= "menubar=no,scrollbars=no,resizable=no,modal=no');"
      End If
      Return jsmodal
    Catch ex As Exception
      Return "alert(" & ex.Message & ");"
    End Try
  End Function
Komentar Asli (3)
Dipulihkan dari Wayback Machine