473,324 Members | 2,456 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Inline Evaluation of a DataBound Value within a Repeater Item Template

Ok. I have been banging my head against the wall trying to figure out
how this piece of display logic can be implemented:

<% if (DataBinder.Eval(Container.DataItem, "SomeItem") != "SomeValue")
{ %>
HTML DISPLAY BLOCK
<% } %>

The reason I would prefer to do it this way is:
(1) Easier management by the HTML producers/designers
(2) It seems pointless to create yet another control for a single
table row or even table cell depending upon the case of HTML formatted
data.

In the future I won't need this but I am dealing with a pre-existing
code base that I don't have the time to change.

-----------------------------------
"Integrity is doing the right thing,
even if nobody is watching."
-----------------------------------
"Normally we do not so much
look at things as overlook them."
Nov 19 '05 #1
2 4859
On Thu, 01 Sep 2005 10:11:23 -0500, Michael Wendel <mw*****@brainlink.com>
wrote:
Ok. I have been banging my head against the wall trying to figure out
how this piece of display logic can be implemented:

<% if (DataBinder.Eval(Container.DataItem, "SomeItem") != "SomeValue")
{ %>
HTML DISPLAY BLOCK
<% } %>

The reason I would prefer to do it this way is:
(1) Easier management by the HTML producers/designers
(2) It seems pointless to create yet another control for a single
table row or even table cell depending upon the case of HTML formatted
data.

In the future I won't need this but I am dealing with a pre-existing
code base that I don't have the time to change.

-----------------------------------
"Integrity is doing the right thing,
even if nobody is watching."
-----------------------------------
"Normally we do not so much
look at things as overlook them."


wrap the HTML block in a asp:panel or a similar container control, set its
Visible property to a databound expression that is your If expression

<asp:panel ... Visible='<%# DataBinder.Eval(Container.DataItem,
"SomeItem") != "SomeValue" %>' ...>
HTML DISPLAY BLOCK
</asp:panel>

I belive this should work...regardless, the DataBinder.Eval only makes
sense inside of a binding statement/expression, not in a script block...

--
craig
Microsoft MVP - ASP/ASP.NET
Nov 19 '05 #2
I'll check it out.

Thanks,

Michael
On Fri, 02 Sep 2005 11:17:58 -0500, "Craig Deelsnyder"
<cdeelsny@no_spam_4_meyahoo.com> wrote:
On Thu, 01 Sep 2005 10:11:23 -0500, Michael Wendel <mw*****@brainlink.com>
wrote:
Ok. I have been banging my head against the wall trying to figure out
how this piece of display logic can be implemented:

<% if (DataBinder.Eval(Container.DataItem, "SomeItem") != "SomeValue")
{ %>
HTML DISPLAY BLOCK
<% } %>

The reason I would prefer to do it this way is:
(1) Easier management by the HTML producers/designers
(2) It seems pointless to create yet another control for a single
table row or even table cell depending upon the case of HTML formatted
data.

In the future I won't need this but I am dealing with a pre-existing
code base that I don't have the time to change.

-----------------------------------
"Integrity is doing the right thing,
even if nobody is watching."
-----------------------------------
"Normally we do not so much
look at things as overlook them."


wrap the HTML block in a asp:panel or a similar container control, set its
Visible property to a databound expression that is your If expression

<asp:panel ... Visible='<%# DataBinder.Eval(Container.DataItem,
"SomeItem") != "SomeValue" %>' ...>
HTML DISPLAY BLOCK
</asp:panel>

I belive this should work...regardless, the DataBinder.Eval only makes
sense inside of a binding statement/expression, not in a script block...


-----------------------------------
"Integrity is doing the right thing,
even if nobody is watching."
-----------------------------------
"Normally we do not so much
look at things as overlook them."
Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Yazeed | last post by:
im adding a Calendar using a template withing a datagrid in edit item template, how can i access the value of the selected date? or where to handle the event SelectedDateChanged ?
0
by: Joel Cade | last post by:
I'm using a repeater to show the rows in a data table. I'd like the have a link button beside each row that removes the record, firing a client script function to prompt the user for confirmation,...
2
by: Jorge Ayala | last post by:
Well I'm trying to catch and act upon a button event that is placed within the item template of a repeater control. Yet the code I'm using isn't working. What I've seen out there to explain how...
1
by: Julius Fenata | last post by:
Dear all, I need help to change my item-template value format... Here is my case, I have a datagrid, with 'SubjectPrice' field, and when the grid displayed, my 'SubjectPrice' field displayed...
1
by: Bhelliom | last post by:
Hi there, something I thought would be really really easy so far hasn't been easy at all. I'm using the Repeater control to produce some HTML with values taken from a DataSet. That is...
2
by: Luis Esteban Valencia Muñoz | last post by:
I have a datagrid that displays editable text fields (2 different price fields) and a checkbox in every row. It has a "SaveChanges" button at the bottom, which, when pressed, looks at every...
4
by: jjack100 | last post by:
I have a DropDownList that is nested inside a Repeater. The datasource of the DropDownList is declared in the aspx, not the codebehind. So we have this: <asp:Repeater ID="rptOptions"...
2
by: KerryL | last post by:
How do I update the value of a databound column within my datagrid from within the SelectedIndexChanged event of a dropdownlist, also found within my datagrid? I believe I need to determine the...
1
by: mark4asp | last post by:
I have a table bound to a repeater. There is a DateTime column called EntryDate. When the EntryDate changes day I want to write the date out. I want to compare the value of an item from a table...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.