locked
Custom Server Properties RRS feed

  • Question

  • User343171648 posted

    Hi,

    I have developed a custom server control with a number of properties.  When I drag the control onto an aspx page a number of the properties are autopopulated within the server tag, which are not wanted.  I have managed to prevent them appearing within the Properties panel using the metadata attribute Browsable(False), but can't find out how to prevent them appearing within the tag itself.

    Any help would be much appreciated

    Edit: The properties are populated to the tag when the control (derived from GridView) is attached to a DataSource

    Tuesday, May 10, 2011 5:15 AM

Answers

  • User-16411453 posted

    This looks like it's suppose to either be a collection of words, or a string or words seperated by a character like , or |


    <Browsable(False), Description("Holds the checkboxfilter values for each filter")> Property CheckBoxFilterValues As List(Of List(Of String)) Get If ViewState("CheckBoxFilterValues") IsNot Nothing Then Return ViewState("CheckBoxFilterValues") Else Return New List(Of List(Of String)) End If End Get Set(ByVal value As List(Of List(Of String))) ViewState("CheckBoxFilterValues") = value End Set End Property

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, May 13, 2011 5:54 PM

All replies

  • User-16411453 posted

    Need to see a property code block first

    Tuesday, May 10, 2011 4:47 PM
  • User343171648 posted

    Here are some sample properties that are being populated in the tags when connected to a datasource

        <Bindable(True), EditorBrowsable(EditorBrowsableState.Never), Browsable(False), DefaultValue(False), Description("Holds the references to each of the checkbox filters associated with the GridView columns."), Localizable(True)>
        Property CheckBoxFilters() As Hashtable
          Get
            If (ViewState("CheckBoxFilters") IsNot Nothing) Then
              Return CType(ViewState("CheckBoxFilters"), Hashtable)
            Else
              Return cbl_filters
            End If
          End Get
          Set(ByVal value As Hashtable)
            ViewState("CheckBoxFilters") = value
          End Set
        End Property
        <Browsable(False), Description("Holds the checkboxfilter values for each filter")>
        Property CheckBoxFilterValues As List(Of List(Of String))
          Get
            If ViewState("CheckBoxFilterValues") IsNot Nothing Then
              Return ViewState("CheckBoxFilterValues")
            Else
              Return New List(Of List(Of String))
            End If
          End Get
          Set(ByVal value As List(Of List(Of String)))
            ViewState("CheckBoxFilterValues") = value
          End Set
        End Property
        <Bindable(True), Browsable(False), Localizable(True)>
        Property ClearFilter() As Boolean
          Get
            If ViewState("ClearFilter") IsNot Nothing Then
              Return ViewState("ClearFilter")
            Else
              Return False
            End If
          End Get
          Set(ByVal value As Boolean)
            ViewState("ClearFilter") = value
          End Set
        End Property

    Thursday, May 12, 2011 7:58 AM
  • User-16411453 posted

    I can see where one of the properties could write code to the design view. I may have to post several responses to help out

    I use this for boolean values, yours did not look clean

     <Bindable(True)> _
        <Category("Container Properties")> _
        <DefaultValue("")> _
        <RefreshProperties(RefreshProperties.Repaint)> _
        <Localizable(True)> _
        Public Property Container_PaintMode() As Boolean
            Get
                Dim _PaintMode As String = CStr(ViewState("Container_PaintMode"))
                If _PaintMode Is Nothing Then
                    Return False
                Else
                    Return _PaintMode
                End If
    
            End Get
            Set(ByVal Value As Boolean)
                ViewState("Container_PaintMode") = Value
            End Set
    
        End Property

    Friday, May 13, 2011 5:51 PM
  • User-16411453 posted

    This looks like it's suppose to either be a collection of words, or a string or words seperated by a character like , or |


    <Browsable(False), Description("Holds the checkboxfilter values for each filter")> Property CheckBoxFilterValues As List(Of List(Of String)) Get If ViewState("CheckBoxFilterValues") IsNot Nothing Then Return ViewState("CheckBoxFilterValues") Else Return New List(Of List(Of String)) End If End Get Set(ByVal value As List(Of List(Of String))) ViewState("CheckBoxFilterValues") = value End Set End Property

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, May 13, 2011 5:54 PM