R
Richard Watt
Hi,
I am developing a custom control that inherits from the
datagrid. I want the normal functionality of the
Datagrid, then several buttons created underneath the
grid (not in the footer or pager).
In my basic example below I am creating a single button
in the overridden CreateChildControls. This compiles ok,
and when I use the control in a page, the grid renders
ok, but I do not see the button. I have played around
with overriding the render method, but everything I read
seems to indicate if you use CreateChildControls you
don't need to render.
What am I missing?
'-----------------------
Public Class MyGrid3
Inherits DataGrid
Dim btn As Button
Protected Overrides Sub CreateChildControls()
Controls.Clear()
btn = New Button
btn.Text = "button"
btn.ID = "btn1"
Controls.Add(btn)
MyBase.CreateChildControls()
End Sub
Public Overrides ReadOnly Property Controls() As
System.Web.UI.ControlCollection
Get
MyBase.EnsureChildControls()
Return MyBase.Controls
End Get
End Property
End Class
Cheers
Richard
I am developing a custom control that inherits from the
datagrid. I want the normal functionality of the
Datagrid, then several buttons created underneath the
grid (not in the footer or pager).
In my basic example below I am creating a single button
in the overridden CreateChildControls. This compiles ok,
and when I use the control in a page, the grid renders
ok, but I do not see the button. I have played around
with overriding the render method, but everything I read
seems to indicate if you use CreateChildControls you
don't need to render.
What am I missing?
'-----------------------
Public Class MyGrid3
Inherits DataGrid
Dim btn As Button
Protected Overrides Sub CreateChildControls()
Controls.Clear()
btn = New Button
btn.Text = "button"
btn.ID = "btn1"
Controls.Add(btn)
MyBase.CreateChildControls()
End Sub
Public Overrides ReadOnly Property Controls() As
System.Web.UI.ControlCollection
Get
MyBase.EnsureChildControls()
Return MyBase.Controls
End Get
End Property
End Class
Cheers
Richard