Can you use DataSource property from event handler?

F

Fred Dag

Hi,
I am trying to get the DataSet from a Repeater using its DataSource property
from an event handler.

I am getting Null instead.

Should the DataSource persist when the event hadler is called or is Null the
expected result?

Still trying to understand the event model.

Thanks in advance.
 
K

Karl Seguin [MVP]

Nope. Values withint the repeater will persist, but only as attributes of
the repeater.

so if you do:

<ItemTemplate>
<asp:literal id="firstName" runat="server"><%#
DataBinder.Eval(Container.DataItem, "FirstName") %></asp:Literal>
</ItemTemplate>

you'll be able to loop through the items of the repeater, retreive the
firstName literal and get it's value.

Otherwise you'll need to persist the data source yourself.

Karl
 

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,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top