Custom control renders table but doesn't resize at design time.

C

Chubby Arse

Hi all,

I have a control, that basically is my own version of the datagrid,
except that is renderers purely readonly tabular information.

When the control is rendered to the designer, I can click on the
control as rendered and move it, however I cannot resize it. I can
change the height and Width properties in the PropertyGrid and they
change, but the control doesn't resize.

When using the mouse to change the size, the control doesn't actually
resize, but the Width and Height properties do change. I can save the
changes, close the webform and open it again and it will display as I
had resized it. Here's a summary of what happens when I use the size
grips (the white boxes at each compass point that allow resizing with
the mouse). None of the these will change the size, some move the
control, some don't even affect the control - but all change the width
and height properties.

N: Moves the control up and down.
NW: Move the control in all directions.
W: Moves the control left and right
SW: Moves the control left and right.
S: No movement
SE: No movement
E: No movement
NE: Move the control up and down.

You can see for yourselves, below is the code for a simple control that
does the same:

Any ideas, it seems that the control is not resizing and re-rendering.
In WindowsForms you would capture the OnResize event and call
Me.Invalidate.

Thanks

Alex

#######Code Start########
Imports System.ComponentModel
Imports System.Web.UI
Imports System.Web.UI.WebControls

<ToolboxData("<{0}:ctlTestGrid runat=server></{0}:TestGrid>")> _
Public Class TestGrid

Inherits System.Web.UI.WebControls.WebControl

Protected Overrides Sub Render(ByVal output As
System.Web.UI.HtmlTextWriter)
EnsureChildControls()
Me.RenderChildren(output)
End Sub

Protected Overrides Sub CreateChildControls()

Dim objTable As New Web.UI.WebControls.Table
For intRow As Int32 = 1 To 5
objTable.Rows.Add(New TableRow)
For intColumn As Int32 = 1 To 5
objTable.Rows(intRow - 1).Cells.Add(New TableCell)
objTable.Rows(intRow - 1).Cells(intColumn - 1).Text =
"######"
Next
Next

objTable.Width = MyBase.Width
objTable.Height = MyBase.Height

Me.Controls.Add(objTable)

End Sub

End Class
#######Code End########
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top