VB-Web: Gridview inheritence and overloading

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Bob Ross
    New Member
    • Jan 2007
    • 119

    VB-Web: Gridview inheritence and overloading

    I am trying to create a custom gridview control that has customisable columns.
    I want to be able to use the the control as I would any other gridview except a couple of extra methods and properties and when I call -
    Code:
    CustomGridview.Columns(10)
    it uses a mapping function created by me to return the correct column.
    But when I call
    Code:
    CustomGridview.Columns()
    it returns the column collection from the base gridview class.
    I think I have achieved that using -
    Code:
    Public Overloads ReadOnly Property Columns(ByVal Index As Integer) As DataControlField
                Get
                    Return SomeMappingFunction(Index)            
                End Get
            End Property
    In the new in the new CustomGridview class deriving from the Gridview class.

    But when I attempt to use this class as a control on the page I get a errors
    "Ambigous match found"
    and
    "Type 'System.Web.UI. WebControls.Cus tomisedGridview ' does not have a public property named 'TemplateField' ."
    for each element inside the <columns> tag.
    What am I doing wrong? How can I get it to use the original columns collection for the <columns> tag on the page?
Working...