473,508 Members | 2,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C# Databinder.Eval didn't work quite right...

Hi,

I'm following

http://msdn.microsoft.com/library/de...ynamically.asp

Why did I have to use this in the event handler?

lc.Text += "<td align=\"left\">" +
((System.Data.DataRow)(((System.Data.DataRowView)( ((System.Object)(container.DataItem)))).Row)).Item Array[0].ToString() + "</td>";

I could never get lc.Text to use DataBinder.Eval on the columns.

code:
....
case ListItemType.Item:
lc.Text = "<tr style=\"background-color:#F0F0F0\">";

lc.DataBinding +=new EventHandler(lc_DataBinding);
break;
case ListItemType.AlternatingItem:
lc.Text = "<tr style=\"background-color:#E0E0E0\">";
lc.DataBinding +=new EventHandler(lc_DataBinding);

break;
case ListItemType.Footer:
lc.Text = "</table>";
break;
....
--
tym, Eskimo
Nov 18 '05 #1
3 1429
Hi Eskimo:

How were you using lc.Text in ASPX?
Here is an article that might help:

Digging Into Data Binding Expressions
http://odetocode.com/Articles/278.aspx

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Fri, 5 Nov 2004 13:58:02 -0800, Eskimo
<Es****@discussions.microsoft.com> wrote:
Hi,

I'm following

http://msdn.microsoft.com/library/de...ynamically.asp

Why did I have to use this in the event handler?

lc.Text += "<td align=\"left\">" +
((System.Data.DataRow)(((System.Data.DataRowView) (((System.Object)(container.DataItem)))).Row)).Ite mArray[0].ToString() + "</td>";

I could never get lc.Text to use DataBinder.Eval on the columns.

code:
...
case ListItemType.Item:
lc.Text = "<tr style=\"background-color:#F0F0F0\">";

lc.DataBinding +=new EventHandler(lc_DataBinding);
break;
case ListItemType.AlternatingItem:
lc.Text = "<tr style=\"background-color:#E0E0E0\">";
lc.DataBinding +=new EventHandler(lc_DataBinding);

break;
case ListItemType.Footer:
lc.Text = "</table>";
break;
...


Nov 18 '05 #2
By extending ITemplate, like in the link I refer to in the initial post

"Scott Allen" wrote:
Hi Eskimo:

How were you using lc.Text in ASPX?
Here is an article that might help:

Digging Into Data Binding Expressions
http://odetocode.com/Articles/278.aspx

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Fri, 5 Nov 2004 13:58:02 -0800, Eskimo
<Es****@discussions.microsoft.com> wrote:
Hi,

I'm following

http://msdn.microsoft.com/library/de...ynamically.asp

Why did I have to use this in the event handler?

lc.Text += "<td align=\"left\">" +
((System.Data.DataRow)(((System.Data.DataRowView) (((System.Object)(container.DataItem)))).Row)).Ite mArray[0].ToString() + "</td>";

I could never get lc.Text to use DataBinder.Eval on the columns.

code:
...
case ListItemType.Item:
lc.Text = "<tr style=\"background-color:#F0F0F0\">";

lc.DataBinding +=new EventHandler(lc_DataBinding);
break;
case ListItemType.AlternatingItem:
lc.Text = "<tr style=\"background-color:#E0E0E0\">";
lc.DataBinding +=new EventHandler(lc_DataBinding);

break;
case ListItemType.Footer:
lc.Text = "</table>";
break;
...


Nov 18 '05 #3
Yes, Eskimo, I did look at the article, but I still don't know what
the rest of your code looks like. I wasn't sure if you were
complaining about the ugliness of the casting expressions or something
not working with data binding.

--
Scott
http://www.OdeToCode.com/blogs/scott/
On Sat, 6 Nov 2004 21:05:01 -0800, Eskimo
<Es****@discussions.microsoft.com> wrote:
By extending ITemplate, like in the link I refer to in the initial post

"Scott Allen" wrote:
Hi Eskimo:

How were you using lc.Text in ASPX?
Here is an article that might help:

Digging Into Data Binding Expressions
http://odetocode.com/Articles/278.aspx

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Fri, 5 Nov 2004 13:58:02 -0800, Eskimo
<Es****@discussions.microsoft.com> wrote:
>Hi,
>
>I'm following
>
>http://msdn.microsoft.com/library/de...ynamically.asp
>
>Why did I have to use this in the event handler?
>
> lc.Text += "<td align=\"left\">" +
>((System.Data.DataRow)(((System.Data.DataRowView) (((System.Object)(container.DataItem)))).Row)).Ite mArray[0].ToString() + "</td>";
>
>I could never get lc.Text to use DataBinder.Eval on the columns.
>
>code:
>...
> case ListItemType.Item:
> lc.Text = "<tr style=\"background-color:#F0F0F0\">";
>
> lc.DataBinding +=new EventHandler(lc_DataBinding);
> break;
> case ListItemType.AlternatingItem:
> lc.Text = "<tr style=\"background-color:#E0E0E0\">";
> lc.DataBinding +=new EventHandler(lc_DataBinding);
>
> break;
> case ListItemType.Footer:
> lc.Text = "</table>";
> break;
>...



Nov 18 '05 #4

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

Similar topics

0
3803
by: Michelle Keys | last post by:
Subject: DataBinder.Eval Error! Server Error in '/MSPOS' Application. ------------------------------------------------------------------------ -------- DataBinder.Eval:...
2
2029
by: dm_dal | last post by:
I have a control on my webform that I am binding to a dataset. The issue is, the field value in the dataset is encrypted and I am trying to decrypt it during the binding process: Example: ...
5
724
by: bg | last post by:
Hi! How do I check if "date" exists before using that code? I've built a RSSreader and sometimes there's a date in it and sometimes not. How can I check if it exists to avoid crash...
1
2224
by: Mike Lerch | last post by:
Pretty much, TSIA, but I'll expand a bit: I'm still trying to get my head around the n-tier approach to web design. It seems to me that when you use DataBinder.Eval in the ASPX that your tiers...
3
1848
by: Patrick Olurotimi Ige | last post by:
Does this work in C# too? <%# SomeFunc(DataBinder.Eval(Containter.DataItem, "ColName")%> *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get...
3
2251
by: Eric Newton | last post by:
Given databinding an array of System.Version types: Given that "SomeObject" type has a Version property: public class SomeObject { public Version Version { get; } public string Description {...
8
2934
by: Randall Parker | last post by:
I want to generate an HTML tag that will look like: <a href="EquipmentServiceCreate.aspx?serial=X01">Create New Service For X01</a> or on a different instance where the user would be viewing...
3
2540
by: Mark Jones | last post by:
I am quite new to ASP and .Net development and I am building a web-based multiple choice exam application. The web page displays the questions using a Repeater control and the answers are nested...
4
7328
by: CharlesA | last post by:
a general question... I'm a bit mystified by Databinder.eval(object, Colname, ) if controls can be bound to their individual data sources within the load event of the page... why would we ever...
0
7410
jinu1996
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...
1
7067
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7505
tracyyun
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...
0
5650
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5060
isladogs
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...
0
4729
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...
0
3215
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...
1
774
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
440
bsmnconsultancy
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...

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.