Master/Detail problem on Whidbey CTP build

  • Thread starter Johnny §õ«¶¿« \(Microsoft MVP for ASP.NET\)
  • Start date
J

Johnny §õ«¶¿« \(Microsoft MVP for ASP.NET\)

The following code is from the online tutorial but it doesn't run on my CTP
build I've just installed.

The first problem is, ImageField doesn't have a public DataField field. Ok,
I removed this line.

The second problem is that "the @EmployeeID column can not be found." Hmmm,
could any one help me verify if the program happens on your side?

BTW, I didn't install SQL 2005. I still use SQL 2000. Can it be the cause of
the problems?

<table cellpadding="10">
<tr>
<td valign="top">
<asp:GridView
ID="MasterGridView"
DataSourceID="MasterSource"
AutoGenerateColumns="false"
DataKeyNames="EmployeeID"
CellPadding="5"
SelectedRowStyle-BackColor="#eeeeee"
Runat="Server">
<Columns>
<asp:TemplateField HeaderText="Employee">
<ItemTemplate>
<asp:LinkButton CommandName="Select" Runat="Server">
<%# Eval("LastName") %>, <%# Eval("FirstName") %>
</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>

</td>
<td valign="top">

<asp:DetailsView
DataSourceID="DetailsSource"
AutoGenerateRows="false"
CellPadding="5"
FieldHeaderStyle-Font-Bold="true"
FieldHeaderStyle-HorizontalAlign="Right"
Runat="Server">
<Fields>
<asp:ImageField DataField="Photo" HeaderText="Photo:" />
<asp:BoundField DataField="LastName"
HeaderText="Last Name:" />
<asp:BoundField DataField="FirstName"
HeaderText="First Name:" />
<asp:BoundField DataField="Extension"
HeaderText="Extension:" />
</Fields>
</asp:DetailsView>
</td>
</tr>
</table>
<asp:SqlDataSource
ID="MasterSource"
EnableCaching="true"
CacheDuration="600"
ConnectionString=
"Server=localhost;database=Northwind;Trusted_Connection=true"
SelectCommand="SELECT * FROM Employees"
Runat="Server" />
<asp:SqlDataSource
ID="DetailsSource"
EnableCaching="true"
CacheDuration="600"
ConnectionString=
"Server=localhost;database=Northwind;Trusted_Connection=true"
SelectCommand="SELECT * FROM Employees"
FilterExpression="EmployeeID=@EmployeeID"
Runat="Server">
<FilterParameters>
<asp:ControlParameter
Name="EmployeeID"
ControlID="MasterGridView"
PropertyName="SelectedValue" />
</FilterParameters>
</asp:SqlDataSource>
 

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

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top