A
Assaf
I am writing a custom itemplate to be used by a
templateColumn in a datagrid. How do I get my hands on the
datagrid's data so I can insert custom contents with
respect to it. In other words, I want to define a
template column class that does something like this:
<asp:datagrid id="dg" runat="server"
AutoGenerateColumns="False">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
'**************************************************
"abc" + <%# DataBinder.Eval
(Container.DataItem, "Description") %></td>
'**************************************************
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
And I want to know where I can get my hands on the
equivalant of <%databinder.eval(...)%> in my code. My
code is as follows:
Public Class inputBoxTemplateColumn
Implements ITemplate
Dim _templateType As ListItemType
Dim _columnName As String
Dim _data As DataTable
Sub New(ByVal type As ListItemType, ByVal ColName
As String)
_templateType = type
_columnName = ColName
End Sub
Sub InstantiateIn(ByVal container As Control) _
Implements ITemplate.InstantiateIn
Dim str As string
Dim box As New TextBox
Select Case _templateType
...
Case ListItemType.Item
'***str = ???(value from dataset)
container.Controls.Add(str)
...
End Select
End Sub
End Class
Any help, direction, or suggestions would be greatly
appreciated.
templateColumn in a datagrid. How do I get my hands on the
datagrid's data so I can insert custom contents with
respect to it. In other words, I want to define a
template column class that does something like this:
<asp:datagrid id="dg" runat="server"
AutoGenerateColumns="False">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
'**************************************************
"abc" + <%# DataBinder.Eval
(Container.DataItem, "Description") %></td>
'**************************************************
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
And I want to know where I can get my hands on the
equivalant of <%databinder.eval(...)%> in my code. My
code is as follows:
Public Class inputBoxTemplateColumn
Implements ITemplate
Dim _templateType As ListItemType
Dim _columnName As String
Dim _data As DataTable
Sub New(ByVal type As ListItemType, ByVal ColName
As String)
_templateType = type
_columnName = ColName
End Sub
Sub InstantiateIn(ByVal container As Control) _
Implements ITemplate.InstantiateIn
Dim str As string
Dim box As New TextBox
Select Case _templateType
...
Case ListItemType.Item
'***str = ???(value from dataset)
container.Controls.Add(str)
...
End Select
End Sub
End Class
Any help, direction, or suggestions would be greatly
appreciated.