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 :
<aspataList ID="DataList1" runat="server" DataKeyField="EventID"
DataSourceID="mySqlDataSource">
<ItemTemplate>
EventID:
<asp:Label ID="EventIDLabel" runat="server" Text='<%#
Eval("EventID") %>'></asp:Label><br />
<br />
</ItemTemplate>
</aspataList>
<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="C:\myPath
\AuctionEvents.mdf";Integrated Security=True;Connect
Timeout=30;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
Thanks !
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 :
<aspataList ID="DataList1" runat="server" DataKeyField="EventID"
DataSourceID="mySqlDataSource">
<ItemTemplate>
EventID:
<asp:Label ID="EventIDLabel" runat="server" Text='<%#
Eval("EventID") %>'></asp:Label><br />
<br />
</ItemTemplate>
</aspataList>
<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="C:\myPath
\AuctionEvents.mdf";Integrated Security=True;Connect
Timeout=30;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
Thanks !