Welcome Guest Search | Active Topics | Sign In | Register

Create CallbackPanel dynamically Options
Samuele
Posted: Monday, June 4, 2007 12:27:30 AM
Rank: Advanced Member
Groups: Member

Joined: 5/31/2007
Posts: 58
Hi,

I've created some Callback panel dynamically but the callback client side return an error.
The code:

Code: Visual Basic.NET
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If Not IsPostBack Then
            CreateTableList()
        End If
    End Sub

    Private Function CreateLink(ByVal Index As Integer) As LinkButton
        Dim HL As LinkButton = New LinkButton
        HL.ID = "HL_" & Index
        HL.Text = "Load"
        Return HL
    End Function

    Private Function CreateCallBackPanel(ByVal Index As Integer, ByVal HL As LinkButton) As EO.Web.CallbackPanel
        Dim CBP As EO.Web.CallbackPanel = New EO.Web.CallbackPanel
        CBP.ID = "CBP_" & Index
        CBP.LoadingHTML = "<DIV><IMG src='images/manage/loading.gif'></DIV>"
        CBP.Controls.Add(New LiteralControl("->"))

        Dim Trigger As EO.Web.CallbackTrigger = New EO.Web.CallbackTrigger(HL.ClientID, Index)
        CBP.Triggers.Add(Trigger)

        AddHandler CBP.Execute, AddressOf CallbackPanelExecute
        Return CBP
    End Function

    Private Sub CallbackPanelExecute(ByVal sender As System.Object, ByVal e As EO.Web.CallbackEventArgs)
        System.Threading.Thread.CurrentThread.Sleep(1000)
    End Sub

    Private Sub CreateTableList()
        For Index As Integer = 1 To 10
            Dim Cell As TableCell = New TableCell
            Dim HL As LinkButton = CreateLink(Index)
            Cell.Controls.Add(HL)

            Dim Row As TableRow = New TableRow
            Row.Cells.Add(Cell)

            Cell = New TableCell
            Cell.Controls.Add(CreateCallBackPanel(Index, HL))
            Row.Cells.Add(Cell)

            TblList.Rows.Add(Row)
        Next
    End Sub
eo_support
Posted: Monday, June 4, 2007 8:05:03 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Hi Samuele,

You need to remove the If statement in the following code:

Code: Visual Basic.NET
If Not IsPostBack Then
     CreateTableList()
End If


ASP.NET view state stores information about each control so that changes to each control themself are persisted, but it does not store information about dynamically creating controls. Which means the CallbackPanel will be created when the page is initially loaded, but it is not created when the page posts back.

Thanks
Samuele
Posted: Tuesday, June 5, 2007 3:05:39 AM
Rank: Advanced Member
Groups: Member

Joined: 5/31/2007
Posts: 58
Very thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.