2012-09-05 88 views
0

我試圖通過創建新實例並將新的屏幕名稱綁定到Twitter並將此控件放置到面板來動態顯示AjaxControlToolkit.Twitter。但它不起作用。有什麼建議麼?動態顯示AjaxControlToolkit.Twitter?

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 
     Dim RandomNumber As New Random() 
     Dim rn As Short 
     rn = RandomNumber.Next(1, 6) 
     Select Case rn 
      Case rn = 1 
       Dim tw As New AjaxControlToolkit.Twitter() 
       tw.ScreenName = "aspnet" 
       tw.DataBind() 
       pnlTw.Controls.Add(tw) 
      Case rn = 2 
       Dim tw As New AjaxControlToolkit.Twitter 
       tw.ScreenName = "smashingmag" 
       tw.DataBind() 
       pnlTw.Controls.Add(tw) 
      Case rn = 3 
       Dim tw As New AjaxControlToolkit.Twitter 
       tw.ScreenName = "LessThanDot" 
       tw.DataBind() 
       pnlTw.Controls.Add(tw) 
      Case rn = 4 
       Dim tw As New AjaxControlToolkit.Twitter 
       tw.ScreenName = "scottgu" 
       tw.DataBind() 
       pnlTw.Controls.Add(tw) 
      Case rn = 5 
       Dim tw As New AjaxControlToolkit.Twitter 
       tw.ScreenName = "Encosia" 
       tw.DataBind() 
       pnlTw.Controls.Add(tw) 
      Case rn = 6 
       Dim tw As New AjaxControlToolkit.Twitter 
       tw.ScreenName = "domvtae" 
       tw.DataBind() 
       pnlTw.Controls.Add(tw) 
     End Select 
    End Sub 

回答

0

問題已解決 - 只是將案件更改爲條件。 ))