locked
Specific property is disabled in design mode RRS feed

  • Question

  • User-2057043396 posted

    Hi all,

    I'm new in creating user web controls. Then, I created the following simple code:

    Imports System
    Imports System.Collections.Generic
    Imports System.ComponentModel
    Imports System.Linq
    Imports System.Text
    Imports System.Web
    Imports System.Web.UI
    Imports System.Web.UI.WebControls
    Imports System.Drawing
    
    <DefaultProperty("Text"), ToolboxData("<{0}:MyButton runat=server></{0}:MyButton>"), _
                              ToolboxBitmap("D:\ValMark\Projetos\Pacotes\WEBEHS\ValMark Controls\Controls\MyButton\MyButton.bmp")>
    Public Class MyButton
        Inherits Button
    
        Private _Test As String
    
        Public Sub New()
    
            Width = 150
            Text = "0"
            BackColor = Color.Yellow
    
        End Sub
    
        <Bindable(True), _
        Category("Appearance"), _
        DefaultValue(""), _
        Localizable(True)> _
        Public Property Test()
            Get
                Return _Test
            End Get
            Set(value)
                _Test = value
            End Set
        End Property
    
        Protected Overrides Sub OnClick(e As EventArgs)
    
            Dim num As Integer = Integer.Parse(Me.Text) + 1
            Me.Text = num.ToString
    
        End Sub
    
    End Class
    

    There is a specific property called "Test". When I put my web control in a page, this property was disabled, as below:

    What am I doing wrong?

    Thanks in advance,

    Camarate

    Monday, April 22, 2019 9:51 PM

All replies