I’m trying to develop a custom GridView control with properties OpenFormModal and ModalWindowWidth and ModalWindowHeight and a few more.
From CustomGridView class I call an instance of CustomGVITemplate:
Protected Overrides Function CreateColumns(ByVal dataSource As PagedDataSource, ByVal useDataSource As Boolean) As ICollection
Dim columnList As ICollection = MyBase.CreateColumns(dataSource, useDataSource)
Dim cmdDel As New TemplateField
cmdDel.ItemTemplate = New CustomGVITemplate(ListItemType.Item, "delete")
'I CAN'T ASSING VALUE TO CUSTOM PROPERTIES HERE
list.Add(cmdDel)
End Function
The thing is, I should access CustomGridView properties from within InstantiateIn sub inside CustomGVITemplate class, the only way I know to do it is pass these parameters through
New CustomGVITemplate(ListItemType.Item, "delete", ALL-OTHER-PROPERTIES-HERE)
I don’t like this solution as I’m forced to do a lot of Optional parameters so not all calls use all properties, also, I can’t find the way to define properties in CustomGVITemplate and asign values to them.
Other possible solutions?
Thank you
SOLVED: The thing was I was trying to access values and proerties in CreateColumns event, when data hasn’t been binded yet, the solution was to create CommandButton (or Button) in CreateColumns events and access properties and DataKeys later, in RowCommand or button OnClick events.