"z. f." <zi**@info-scopeREMSPAM.co.il> wrote in message
news:eo**************@TK2MSFTNGP15.phx.gbl...
Hi,
i'm using code in my aspx page.
i have data binding where i use <%# Container.DataItem("DateStart") %>
i also use code that makes a loop inside a regular
<%
%>
block
how can i pass data from the databinding to the loop that runs in a
regular block.
if i try to call the Container.DataItem from the regular code block i get
error it is not defined in this stage.
how can i make loop in my data binding stage?
why is this not documented so well?
if there is a link to some good documentation it will be halpfull also.
You need to understand that the <%# %> block is executed
when you call the DataBind() method of the page or control.
The <% %> block is executed during the rendering of the page,
this is after all the events have been handled, all the other code
has been executed, and right before the page is sent to the client.
At that time, the datasource has already been destroyed, which
is why you don't have access to the DataItem.
A good way to solve your problem in ASP.NET would be to
replace the <% %> block by a Literal or Label server control, and
to set the contents of the Literal or Label control right before or
after the DataBind() call.
Jos