I'm trying to to something very similar to this:
http://forums.labs.infragistics.com/forums/t/842.aspx
But I want to do it via code behind and am having no luck. Right now a column is created but it does not paint my template This is what I have so far:
My grid builds fine - in the prerender of the page I add my templated column
ResultsGridUltra.Columns.Insert(0, btnCol)
My template looks like this:
Private WithEvents _actionButton As ImageButtonPublic Sub InstantiateIn(ByVal container As System.Web.UI.Control) Implements System.Web.UI.ITemplate.InstantiateIn_actionButton = New ImageButton_actionButton.ImageUrl = "..//images/action.gif"
container.Controls.Add(_actionButton)
End Sub
End Class
Any ideas?
Have you seen the example in the knowledgebase for creating dynamic column templates?
I figured out my issue. It's an order of events issue. I was trying to add the templated column in the page pre-render. I needed to handle the InitializeLayout event of the grid and add it at that point. I'm using the latest version of the grid (2007 vol3) and .NET 2.0 so the examples weren't very useful. I converted them to 2.0 but then couldn't step through them because of the different grid version.
Anyway - for those who might hit this in the future the code looks like this:
And my templated col class: