Eval function

Z

Zeba

Hi,

Can you tell me how does the Eval function know where to find EventID
in the following code ?

Also, isn't this Eval function same as the DataBinder.Eval ? But MSDN
only shows Eval() to be overloaded with 2 / 3 parameters. Also why
dont we have to write DataBinder.Eval in full ( I have only included
the name space System.Web.UI in the code-behind)

Code is given below :

<asp:DataList ID="DataList1" runat="server" DataKeyField="EventID"
DataSourceID="mySqlDataSource">
<ItemTemplate>
EventID:
<asp:Label ID="EventIDLabel" runat="server" Text='<%#
Eval("EventID") %>'></asp:Label><br />
<br />
</ItemTemplate>
</asp:DataList>
<asp:SqlDataSource ID="mySqlDataSource" runat="server"
ConnectionString="<%$
ConnectionStrings:myAuctionEventsConnectionString %>"
SelectCommand="SELECT * FROM [AuctionEventsDB]"></
asp:SqlDataSource>

The web.config has the following entry :
<connectionStrings>
<add name="myAuctionEventsConnectionString" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=&quot;C:\myPath
\AuctionEvents.mdf&quot;;Integrated Security=True;Connect
Timeout=30;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>


Thanks !
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,610
Members
45,259
Latest member
JorjaBurne

Latest Threads

Top