以不實做物件情況下,模仿 Ajax 的 ModalPopup

IE8 與 Chrome 測試正常

LikeAjaxModalPopup.aspx
---------------------------------------
不實做,所以就原本的程式

LikeAjaxModalPopup.aspx.vb
---------------------------------------
Partial Class LikeAjaxModalPopup
    Inherits System.Web.UI.Page
    Dim SM As New ScriptManager
    Dim UP As New UpdatePanel
    Dim UPR As New UpdateProgress
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        SM.ID = "ScriptManager1"
        Page.Form.Controls.Add(SM)
        UP.ID = "UpdatePanel1"
        Page.Form.Controls.Add(UP)
        UPR.ID = "UpdateProgress1"
        Page.Form.Controls.Add(UPR)
        Dim BR As String = Nothing
        For i As Integer = 0 To 50
            BR += "<BR />"
        Next
        UP.ContentTemplateContainer.Controls.Add(New LiteralControl(BR))
        Dim btnShowIt As New Button
        btnShowIt.ID = "btnShowIt"
        btnShowIt.Text = "Show it"
        UP.ContentTemplateContainer.Controls.Add(btnShowIt)
        AddHandler btnShowIt.Click, AddressOf btnShowIt_Click
        InitialParameter()
    End Sub
    Sub InitialParameter()
        Dim cssText As String
        cssText = "<style type='text/css'>"
        cssText += "    .GrayFullScreen"
        cssText += "    {"
        cssText += "        display: block;    "
        cssText += "        position:fixed;"
        cssText += "        top:0;"
        cssText += "        left:0;"
        cssText += "        width:100%;"
        cssText += "        height:100%;"
        cssText += "        background-color:Gray;"
        cssText += "        filter:alpha(opacity=70);opacity:0.7;zoom:1;"
        cssText += "        z-index:100;"
        cssText += "    }"
        cssText += "</style>"
        Page.Controls.Add(New LiteralControl(cssText))
        Dim divMSG As String = "<div id='divMSG' class='GrayFullScreen'></div>"
        UPR.Controls.Add(New LiteralControl(divMSG))
        Dim tbDoing As String
        tbDoing = "<table id='tbDoing' border='6' style='background-color:White; border-color: #6699FF; border-style: outset; "
        tbDoing += "      width:350px; height:300px; position:fixed; top:30%; left:35%; z-index:101'>"
        tbDoing += "    <tr><td align='center' valign='middle'>"
        tbDoing += "        <img alt='working...' src='Images/bigrotation.gif'/><br/><br/>working..."
        tbDoing += "    </td></tr>"
        tbDoing += "</table>"
        UPR.Controls.Add(New LiteralControl(tbDoing))
    End Sub
    Protected Sub btnShowIt_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        'Let's program do something as possible as long time
        Threading.Thread.Sleep(5000)
    End Sub
End Class

1 則留言: