A
Anonymous
Hey,
I am adding a column dynamically to a datagrid, with
the following code:
Dim objTC As New TemplateColumn
objTC.ItemStyle.Width = Unit.Percentage(2)
objTC.ItemTemplate = New ExpandCollapseButtonTemplate
Columns.Add(objTC)
' the class for the column
Private Class ExpandCollapseButtonTemplate
Implements ITemplate
Sub InstantiateIn(ByVal container As Control)
Implements ITemplate.InstantiateIn
' create the image button for the +/- image
' and define the parameters
Dim btnExpand As New ImageButton
btnExpand.ImageUrl = "~/Images/Plus.gif"
btnExpand.ID = "btnExpand"
btnExpand.EnableViewState = True
btnExpand.CommandName = "Expand"
' add the imagebutton to the parent which is
our
' datagrid and here defined as container.
container.Controls.Add(btnExpand)
End Sub
End Class
This adds a new button in each row for the first cell.
However it adds the button for Item and AlternatingItem,
But Now I would like to add something else for the
alternatingItem. Any idea how I can do that?
Thanks
I am adding a column dynamically to a datagrid, with
the following code:
Dim objTC As New TemplateColumn
objTC.ItemStyle.Width = Unit.Percentage(2)
objTC.ItemTemplate = New ExpandCollapseButtonTemplate
Columns.Add(objTC)
' the class for the column
Private Class ExpandCollapseButtonTemplate
Implements ITemplate
Sub InstantiateIn(ByVal container As Control)
Implements ITemplate.InstantiateIn
' create the image button for the +/- image
' and define the parameters
Dim btnExpand As New ImageButton
btnExpand.ImageUrl = "~/Images/Plus.gif"
btnExpand.ID = "btnExpand"
btnExpand.EnableViewState = True
btnExpand.CommandName = "Expand"
' add the imagebutton to the parent which is
our
' datagrid and here defined as container.
container.Controls.Add(btnExpand)
End Sub
End Class
This adds a new button in each row for the first cell.
However it adds the button for Item and AlternatingItem,
But Now I would like to add something else for the
alternatingItem. Any idea how I can do that?
Thanks