Hi,
i'm using code in my aspx page.
i have data binding where i use <%# Container.DataI tem("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.DataI tem 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.
TIA, z. 3 1730
"z. f." <zi**@info-scopeREMSPAM.co .il> wrote in message
news:eo******** ******@TK2MSFTN GP15.phx.gbl... Hi,
i'm using code in my aspx page.
i have data binding where i use <%# Container.DataI tem("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.DataI tem 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
i would be glad to accept your suggestion,
the problem is that my code runs in a loop inside a repeater, this why i
had the problem in the first place.
"Jos" <jo************ ***@fastmail.fm > wrote in message
news:ug******** ******@TK2MSFTN GP14.phx.gbl... "z. f." <zi**@info-scopeREMSPAM.co .il> wrote in message news:eo******** ******@TK2MSFTN GP15.phx.gbl... Hi,
i'm using code in my aspx page.
i have data binding where i use <%# Container.DataI tem("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.DataI tem 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
Move all the code into the OnItemDataBound event handler something like this
private void dlMailing_ItemD ataBound(object sender, RepeaterItemEve ntArgs e)
{
if (e.Item.ItemTyp e == ListItemType.Al ternatingItem ||
e.Item.ItemType == ListItemType.It em)
{
DbDataRecord dbr = (DbDataRecord)e .Item.DataItem;
CheckBox cb = (CheckBox )e.Item.FindCon trol ("cbSubscrib e") ;
Label lb = (Label )e.Item.FindCon trol ("lblMailingLis t") ;
cb.Text = dbr["Name"].ToString () ;
lb.Text = dbr["Descriptio n"].ToString () ;
// Some loop here....
}
}
Stephen
"z. f." <zi**@info-scopeREMSPAM.co .il> wrote in message
news:uj******** ******@TK2MSFTN GP14.phx.gbl... i would be glad to accept your suggestion, the problem is that my code runs in a loop inside a repeater, this why i had the problem in the first place. "Jos" <jo************ ***@fastmail.fm > wrote in message news:ug******** ******@TK2MSFTN GP14.phx.gbl... "z. f." <zi**@info-scopeREMSPAM.co .il> wrote in message news:eo******** ******@TK2MSFTN GP15.phx.gbl... > Hi, > > i'm using code in my aspx page. > > i have data binding where i use <%# Container.DataI tem("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.DataI tem 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
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Arne Schirmacher |
last post by:
I want to display a MySQL database field that can contain HTML markup.
If I use <esql:get-string> then I get all of the database field, but
all tags are escaped which is not what I want. If I use <esql:get-xml>
the tags are not escaped, but only the first part of the database
field is displayed.
The content of the database field is:
"<h1>Title</h1><h2>Subtitle</h2>"
|
by: Mark Moore |
last post by:
It looks like there's a pretty serious CSS bug in IE6
(v6.0.2800.1106). The HTML below is validated STRICT HTML 4.01 and
renders as I would expect in Opera, FrontPage, and Netscape.
For some reason, there's an annoying vertical gap between adjacent
rules that doesn't go away. This looks like IE6 is incorrectly
setting the margin to some arbitrary value.
Does anyone know if this is a known bug at MS? If you know of one,
post the...
|
by: TR |
last post by:
Is it possible with CSS to prevent this wrapping alignment with a checkbox
with a nested label?
This is the label of the
checkbox that wraps beneath it
I'd prefer it looked like this, with a flush left margin:
|
by: ryan.mclean |
last post by:
Hello everyone. Hope ya'll had a nice New Year. Anyway, my question
is why won't this work? I must be doing something dumb . . . here is
the code:
in the body tag, I have this code (just to test):
<script LANGUAGE="javascript">
<!--
function hiThere() {
alert("hi");
|
by: laurence |
last post by:
I am implementing a comprehensive image-map generator utility, so have been
studying W3C HTML 4.01 Specification
(http://www.w3.org/TR/html4/struct/objects.html#h-13.6) on image maps (among
other things).
I note the document specifies that block level content can be included
within a <map>. Testing this in order to discover why one might wish to do
this, I find the block level content is rendered in page flow order anyway,
and not...
| |
by: Josef K. |
last post by:
Asp.net generates the following html when producing RadioButton lists:
<td><input
id="RadioButtonList_3"
type="radio"
name="MyRadioButtonList"
value="644"
onclick="__doPostBack('SitesRadioButtonList_3','')"
language="javascript" />
|
by: rob c |
last post by:
This is a minor thing and only appears in IE (so far), but I'd like to know to
correct it (if possible).
Whenever I use a form on a webpage, Explorer always leaves a blank line
following the </form> tag but Mozilla doesn't. Is there a way to supress the
blank line?
Thanks
Rob
www.rcp.ca
|
by: GloStix |
last post by:
For some reason, FF likes to put a black underline on all my buttons.
No matter what I do, it has the line
I've tried displaying as block and cursor, anything..
Also I've been trying to get it so the entire block is clickable, not just the text.
I've sorta got it so it's clickable, just some parts of the button I still can't click on.
The website is http://pdhtdev.johnabbott.qc.ca/students/2010/james_mann/portfolio/index.htm
The css...
|
by: Roedy Green |
last post by:
The only browser I have encountered that supports
<colgroup><col class="behold"></colgroup>
to apply a CSS style to a whole column, is Microsoft Internet
Explorer. I have been told it SHOULD NOT do so, since this is not
part of the specification.
How then to you apply styles to entire columns? Surely you don't have
to write
<td class="behold"on every row item.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |