473,831 Members | 2,254 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Data Binding Expression Syntax

JV

I just converted a big web project from VB.NET to C# and I got some very
strange runtime errors. Apparently, throughout the ASPX pages, the VB
version of this project used the expression <%#
Container.DataI tem("columnName ") %> inside an <ItemTemplate > tag for
DataGrid. Apparently though this works fine in VB.NET, for some reason C#
chokes on it. I have found that replacing those expressions with <%#
DataBinder.Eval (Container.Data Item, "columnName ")%> makes the errors go
away, but I can't figure out why. It seems to me that the evaluation of
data binding expressions embedded in the ASPX page should work identically
in both languages?

Can anyone explain the arcane rules of this syntax?

Nov 17 '05
11 4838
JV
That's a great article. I'm still puzzled why I had trouble with the
following syntax even though I've seen it recommended:

<%# ((DataRowView)C ontainer.DataIt em)["EmployeeNa me"] %>

This generated an error for me.

"Cor Ligthert" <no************ @planet.nl> wrote in message
news:OI******** ******@TK2MSFTN GP09.phx.gbl...
JV,

Just Google and you get this page, in my opinion does it says everthing
that you ask for.

http://weblogs.asp.net/rajbk/archive...20/188868.aspx

I am fighting as well forever with the documentation from the eval on
MSDN. When I would have to tell what are the ten worst documented parts on
MSDN. Then I would surely have the Eval in it..

Cor

Nov 17 '05 #11
JV,
<%# ((DataRowView)C ontainer.DataIt em)["EmployeeNa me"] %>

This means that you use as datasource from by instance a DataList a
DataRowView, which is a row of a Dataview or with another name
datatable.defau ltview. I don't think that you are doing that.

Cor
Nov 17 '05 #12

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

Similar topics

16
2094
by: gaudetteje | last post by:
I just read in the 'What's New in Python 2.4' document that the None data type was converted to a constant: http://python.org/doc/2.4/whatsnew/node15.html """ # None is now a constant; code that binds a new value to the name "None" is now a syntax error. """ So, what's the implications of this? I find the lack of explanation a
4
5409
by: | last post by:
I have a datagrid with a template column that has a hyperlink and a label. The hyperlink text is bound to Title from my dataset and the label text is bound to Author in the dataset. The grid displays with the template columns showing the Title and the Author from the first row in all rows. The other none template columns are fine. Obviously I am not understanding something here. What am I missing????? -- Barry Fitzgerald
5
1780
by: Brian Henry | last post by:
Hello, I am working on a simple email website that is kinda like hotmail... but the listing of messages is in a data grid data bound to a table called messages... now one of the columns in the messages data table is called read if the value is 1 the message is read if 0 then unread... what i want to do is show an image in the listing based on that value, if 1 then icn-msg-read.gif will be showed in that column for that message row, if 0...
0
5683
by: NicK chlam via DotNetMonster.com | last post by:
this is the error i get System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement. at System.Data.Common.DbDataAdapter.Update(DataRow dataRows, DataTableMapping tableMapping) at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable) at System.Data.Common.DbDataAdapter.Update(DataSet dataSet) at TryThis.Form1.save() in C:\Documents and Settings\Nick\My Documents\...
11
1744
by: JV | last post by:
I just converted a big web project from VB.NET to C# and I got some very strange runtime errors. Apparently, throughout the ASPX pages, the VB version of this project used the expression <%# Container.DataItem("columnName") %> inside an <ItemTemplate> tag for DataGrid. Apparently though this works fine in VB.NET, for some reason C# chokes on it. I have found that replacing those expressions with <%# DataBinder.Eval(Container.DataItem,...
4
3240
by: hope | last post by:
Hi, How can I format a string field using Data Formatting Expression property in datagrid? For example: format last name from BROWN to Brown. Thanks
3
1770
by: Wilson | last post by:
Hi, Can I do data binding for a textbox in a webform at server side ? not using the Data Binding Expression. Thanks Wilson
18
2063
by: mdh | last post by:
>From p112 ( K&R). Given an array declared as static char arr= { { 0,1,........},{0,1,.....}}; let arr be passed as an argument to f. f( int (*arr) ) {....} It is noted that the parentheses are necessary else it would be
6
4610
by: Tomasz J | last post by:
Hello developers, I bind my TextBox control specyfying a format stored in my application global ApplicationContext object - it has a static string CurrencyFormat property. The problem - this works fine: Text='<%# Eval("Price", ApplicationContext.CurrencyFormat) %>'
0
9793
marktang
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...
0
10494
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 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...
1
10534
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9317
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5620
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...
0
5785
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4417
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3964
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3076
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 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...

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.