Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Professional
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 3rd, 2004, 09:51 AM
Registered User
Join Date: Jul 2004
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Data Binding to List Controls

hi there,

I ve been reading the Book Professional ASP.Net 1.0 more precisely chapter 7. on List controls and data binding. One thing that seems for me obscure I d like pose you . Hope someone can help with this. The book states that <%# DataBinder.Eval(Container.DataItem, "field-name") %> makes a performance hit i.e. an overhead so it should be avoided unless we deal with formatting. In my code I have just have fields that I have defined in ItemTemplate for DataList so there s a hyperlink defined which takes it caption from the datasource field. So there s nothing with formatting . I try to use Container.DataItem("field-name") but it gives error.it says it should expecting a method instead of property..? I just try to avoid from the overhead.. but I can handle.. the code in books reveal it should quite work well.. my great pre-thanx

  #2 (permalink)  
Old July 3rd, 2004, 04:51 PM
Friend of Wrox
Join Date: Oct 2003
Location: Cairo, , Egypt.
Posts: 336
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alyeng2000

just bind properties Text,Value fields like this way
DataTextField="CategoryName" DataValueField="CategoryId"

Ahmed Ali
Software Developer
  #3 (permalink)  
Old July 3rd, 2004, 10:54 PM
Friend of Wrox
Points: 3,558, Level: 25
Points: 3,558, Level: 25 Points: 3,558, Level: 25 Points: 3,558, Level: 25
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: California, USA
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik

This is a simple linkBox Binding sample using SQL Server 2000 [u]Northwind Database</u>

<%@ Page Language="C#" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>

<Script Runat="Server">
  void Page_Load( Object s, EventArgs e )
    SqlConnection myConnection;
    SqlCommand myCommand;
    myConnection = new SqlConnection( "Server=Localhost;uid=sa;Database=Northwind" );
    myCommand = new SqlCommand( "Select CategoryName from Categories", myConnection );
    myDataList.DataSource = myCommand.ExecuteReader();


<form Runat="Server">
<asp:DataList id="myDataList" Runat="Server">
        <%# DataBinder.Eval( Container.DataItem, "CategoryName" ) %>


Hovik Melkomian.

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Binding Controls zulf Infopath 0 October 8th, 2007 11:22 PM
Binding controls Boris Kofman VB Databases Basics 1 January 20th, 2007 01:16 PM
BINDING DATA WITH SIMPLE CONTROLS saraswathyrajaram ASP.NET 1.0 and 1.1 Basics 13 August 29th, 2006 03:09 PM
Visible property of controls in data list acko ASP.NET 1.x and 2.0 Application Design 1 December 9th, 2003 10:41 AM
Data list binding Alok Gupta .NET Web Services 0 September 4th, 2003 05:00 AM

All times are GMT -4. The time now is 12:51 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.