N
Nenad Prekupec
Hi,
I'm writing custom control inherited from system.web.ui.webcontrols.panel. I
want that MyPanel make some modifications in rendering panel with its child
controls and add some button to render (and raise events) on that panel. I
have created control and it works fine BUT....
After post back of aspx page, all child controls on MyPanel are losing
entered data. It's not the metter of post back data binding!
It's the metter of Moving Child controls from Controls collection of base
class to Controls collection of Cell control. In this proccess of moving
texboxes (and other MyPanel child controls) loose properties.
MyPanel implements INamingContainer. If I remove this implementation (class
without INamingConatiner) on MyPanel, control renders the way I want , but
then Events are not working; and if I put INamingContainer back, rendering
of child controls values is not working.
Does anybody know how to do this?
Now my idea was to create Table class hierarchy in CreateChildControls()
method like this:
Protected Overrides Sub CreateChildControls()
mybase.CreateChildControls() ' I concluded that Controls
collection at this point is full of controls that were Drag&droped on
MyPanel at design-time
Dim mainTable1 As New Table
Dim mainRow1 As New TableRow
Dim mainCell1 As New TableCell
While (Me.Controls.Count <> 0)
mainCell1.Controls.Add(Controls(0))
End While
...
... lines of code adding cells in rows, rows in table
...
Dim btnOk As New Button
btnOk.Text = "Ok"
AddHandler btnOk.Click, AddressOf ButtonOkClick
..
... adding button in table cell control collection
..
End Sub
P.S. VS2003, VB.NET framework ver 1.1
I'm writing custom control inherited from system.web.ui.webcontrols.panel. I
want that MyPanel make some modifications in rendering panel with its child
controls and add some button to render (and raise events) on that panel. I
have created control and it works fine BUT....
After post back of aspx page, all child controls on MyPanel are losing
entered data. It's not the metter of post back data binding!
It's the metter of Moving Child controls from Controls collection of base
class to Controls collection of Cell control. In this proccess of moving
texboxes (and other MyPanel child controls) loose properties.
MyPanel implements INamingContainer. If I remove this implementation (class
without INamingConatiner) on MyPanel, control renders the way I want , but
then Events are not working; and if I put INamingContainer back, rendering
of child controls values is not working.
Does anybody know how to do this?
Now my idea was to create Table class hierarchy in CreateChildControls()
method like this:
Protected Overrides Sub CreateChildControls()
mybase.CreateChildControls() ' I concluded that Controls
collection at this point is full of controls that were Drag&droped on
MyPanel at design-time
Dim mainTable1 As New Table
Dim mainRow1 As New TableRow
Dim mainCell1 As New TableCell
While (Me.Controls.Count <> 0)
mainCell1.Controls.Add(Controls(0))
End While
...
... lines of code adding cells in rows, rows in table
...
Dim btnOk As New Button
btnOk.Text = "Ok"
AddHandler btnOk.Click, AddressOf ButtonOkClick
..
... adding button in table cell control collection
..
End Sub
P.S. VS2003, VB.NET framework ver 1.1