473,396 Members | 1,893 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Master/Detail problem on Whidbey CTP build

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_Conne ction=true"
SelectCommand="SELECT * FROM Employees"
Runat="Server" />
<asp:SqlDataSource
ID="DetailsSource"
EnableCaching="true"
CacheDuration="600"
ConnectionString=
"Server=localhost;database=Northwind;Trusted_Conne ction=true"
SelectCommand="SELECT * FROM Employees"
FilterExpression="EmployeeID=@EmployeeID"
Runat="Server">
<FilterParameters>
<asp:ControlParameter
Name="EmployeeID"
ControlID="MasterGridView"
PropertyName="SelectedValue" />
</FilterParameters>
</asp:SqlDataSource>
Nov 19 '05 #1
1 1186
Haaa! I found the solution by myself from the MSDN product feedback center.

There is a syntax change in the new version, just change

FilterExpression="EmployeeID='@Employee'"

to

FilterExpression="EmployeeID='{0}'"

and the problem is gone.

Refer to
http://lab.msdn.microsoft.com/produc...3-d5ee72fd9303

"Johnny §õ«¶¿« (Microsoft MVP for ASP.NET)" <jo****@phone.idv.tw> ¼¶¼g©ó¶l¥ó
·s»D:OM*************@TK2MSFTNGP10.phx.gbl...
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_Conne ction=true"
SelectCommand="SELECT * FROM Employees"
Runat="Server" />
<asp:SqlDataSource
ID="DetailsSource"
EnableCaching="true"
CacheDuration="600"
ConnectionString=
"Server=localhost;database=Northwind;Trusted_Conne ction=true"
SelectCommand="SELECT * FROM Employees"
FilterExpression="EmployeeID=@EmployeeID"
Runat="Server">
<FilterParameters>
<asp:ControlParameter
Name="EmployeeID"
ControlID="MasterGridView"
PropertyName="SelectedValue" />
</FilterParameters>
</asp:SqlDataSource>

Nov 19 '05 #2

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

Similar topics

4
by: John Holmes | last post by:
With ASP we have setup a pretty good method for maintaining a consistent look and feel with minimal effort. The method has it's pros and cons, but the maintenance is minimal. The method consists of...
2
by: ruca | last post by:
Hi, I have a master and a detail datagrid. I put detail grid showing insise of a column of master grid. The problem is that it's not what I really want. What I really want would be that the...
4
by: Jerome | last post by:
Hi, I've got a table like this Cat1 ¦ Item1 Cat1 ¦ Item2 Cat1 ¦ Item3 Cat2 ¦ ItemA Cat2 ¦ ItemB
3
by: sqlboy2000 | last post by:
Hi, I've just started playing around with master / detail pages and I'm trying to simply change the detail page displayed in the contentplaceholder control from code behind. I can't seem to find...
1
by: Sam | last post by:
Attached I am sending 2 URL's from MSFT ASP.net Quick Start Tutorial Web Site. 1) Run it URL: http://www.asp.net/QuickStart/aspnet/samples/data/GridViewMasterDetai... 2) View Source URL:...
0
by: Sam | last post by:
Sorry to post the same post multiple times but the URL Addresses were not Correct in Earlier Posts. Here are the correct URL's: 1) Run It URL is here: ...
1
by: Gary200 | last post by:
Hello All, I bind two datagrids in a master-detail relationship successfully. What I want is to set allowNew and allowDelete disabled in both datagrid using dataview. The code like this: ...
0
by: Mike Wilson | last post by:
Dear group, I have an invoice entry form, which is a simple Master fields / Detail grid. The main summary information of the invoice are stored in one table in a dataset, which is bound using a...
2
by: John | last post by:
Hi I am trying to create a master/detail form. I have my master and details tables dragged onto the dataset. I have also dragged the fields from master table on the form which has created the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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,...

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.