custom templateColumn

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,206
Latest member
SybilSchil

Latest Threads

Top