回讀者動態加入 UpdateProgress 的問題 - 使用 VB 程式碼

摘要:回讀者動態加入 UpdateProgress 的問題 - 使用 VB 程式碼

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) _
    Handles Me.Load

    Dim myUpdateProgress As UpdateProgress = New UpdateProgress()
   
myUpdateProgress.ProgressTemplate = New BarGif("Bar1.gif"
    myUpdateProgress.ID = "GifAndText"
  

    Page.Form.Controls.Add(myUpdateProgress)
End Sub

Public Class BarGif
   
Inherits TemplateControl
    
Implements ITemplatePrivate _barPic As String

    Sub New(ByVal template As String)
        
Me._barPic = template
    
End Sub

   
Sub InstantiateIn(ByVal container As Control) _
        
Implements ITemplate.InstantiateIn
      
Dim lc As LiteralControl = New LiteralControl("<img src=" & Me._barPic & "/>")
       
container.Controls.Add(lc)
       
Dim _Label As Label = New Label()
        _Label.ID = "Label1"
        _Label.Text = " 載入中.."
        container.Controls.Add(New LiteralControl("<br />"))
        ontainer.Controls.Add(_Label)
    End Sub
End Class

' 按下按鈕時刻意暫停三秒鐘 
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) _
    Handles Button1.Click
    System.Threading.Thread.Sleep(3000)
End Sub


章立民研究室