Dynamic Datalists

V

Vishal

Hey,

I have created a datalist dynamically and add the
DataBinding event to the label controls. Now the event is
called and everything works. However I also need to access
the value of the label after the databinding, which gives
me always an empty string. Why is that so?

Here is what I did:

Sub InstantiateIn(ByVal container As Control) Implements
ITemplate.InstantiateIn
Dim lbl As New Label
lbl.ID = "lblName"
AddHandler lbl.DataBinding, AddressOf
TemplateControl_DataBinding

....

'Access Value variable here... BUT its empty :S Though
the list shows the values.
End Sub



Private Sub TemplateControl_DataBinding(ByVal sender As
Object, ByVal e As System.EventArgs)
Dim lbl As Label
lbl = CType(sender, Label)
Dim container As DataListItem
container = CType(lbl.NamingContainer,
DataListItem)
lbl.Text &= container.DataItem(lbl.ID).ToString
()
Value = container.DataItem(lbl.ID).ToString()
End Sub


Any help or suggestion is 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,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top