Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Resize Custom Server Control

Status
Not open for further replies.

FancyPrairie

Programmer
Joined
Oct 16, 2001
Messages
2,917
Location
US
I don't know how to setup a custom server control so that when I drop the control in the design window of Visual Studio 2005, I'll be able to resize it simply by grabbing the resize handles of the control.

What am I misssing?

Code:
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Text
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.Design
Imports System.Web.UI.Design.WebControls


<DefaultProperty("Text"), ToolboxData("<{0}:SingleTextBox runat=server></{0}:SingleTextBox>")> _
Public Class SingleTextBox
    Inherits System.Web.UI.WebControls.WebControl
    Implements INamingContainer

    Dim tbFirst As TextBox

    <Bindable(True), Category("Appearance"), DefaultValue(""), Themeable(False), Localizable(True)> _
    Property Text() As String
        Get
            Dim s As String = CStr(ViewState("Text"))
            If s Is Nothing Then
                Return String.Empty
            Else
                Return s
            End If
        End Get

        Set(ByVal Value As String)
            ViewState("Text") = Value
        End Set
    End Property

    Protected Overrides Sub CreateChildCOntrols()
        tbFirst = New TextBox
        Controls.Add(tbFirst)
    End Sub

    Protected Overrides Sub render(ByVal output As HtmlTextWriter)
        EnsureChildControls()
        RenderChildren(output)
    End Sub

End Class
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top