473,407 Members | 2,315 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,407 software developers and data experts.

trouble with Master-Details list

I'm trying to link a gridview to another gridview in a Master-Details
architecture. But the Details list isn't filtering like it is
suppossed to. It will show all items on page load and it won't remove
any items when an item in the Masters list is selected. It shouldn't
show anything until an item in the Master's list is selected and then
only show the details which are associated with the selected item in
the Masters list.
I'm new to ASP.NET (one of the last straglers moving from VBScript)
and, so, I'm probably doing something pretty stupid, but some help
would be really appreciated.
Here's the code

<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile=""

SelectCommand="SELECT DISTINCT org FROM Orgs"
OnSelecting="AccessDataSource1_Selecting1"></asp:AccessDataSource>

<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False"

DataSourceID="AccessDataSource1" Style="z-index: 100; left:
6px; position: absolute;

top: 7px" DataKeyNames="org"
OnSelectedIndexChanged="GridView1_SelectedIndexCha nged"
BorderStyle="None" PageSize="20">

<Columns>

<asp:HyperLinkField DataNavigateUrlFields="org"
DataNavigateUrlFormatString="Details.aspx?field={0 }"

DataTextField="org" />

</Columns>

</asp:GridView>

<asp:AccessDataSource ID="AccessDataSource2" runat="server"
DataFile=""

OnSelecting="AccessDataSource2_Selecting1"
SelectCommand="SELECT Orgs.org, ThreeLetter.[position],
ThreeLetter.location, [user].Name, rights.Type FROM (((Orgs INNER JOIN
ThreeLetter ON Orgs.ID = ThreeLetter.Orgs_ID) INNER JOIN rights ON
ThreeLetter.officeKey = rights.officeKey) INNER JOIN [user] ON
rights.userKey = [user].userKey) ORDER BY Orgs.org"
FilterExpression="Org='@Org'">

<FilterParameters><asp:ControlParameter Name="Org"
ControlID="GridView1" PropertyName="SelectedValue"
/></FilterParameters>

</asp:AccessDataSource>

<asp:GridView ID="GridView2" runat="server"
AutoGenerateColumns="False" DataKeyNames="org,Name"

DataSourceID="AccessDataSource2" Style="z-index: 103; left:
115px; position: absolute;

top: 9px">

<Columns>

<asp:CommandField HeaderText="Edit Rights"
ShowEditButton="True" ShowHeader="True" />

<asp:BoundField DataField="position"
HeaderText="position" SortExpression="position" />

<asp:BoundField DataField="location"
HeaderText="location" SortExpression="location" />

<asp:BoundField DataField="Type" HeaderText="Type"
SortExpression="Type" />

</Columns>

</asp:GridView>

Jul 29 '06 #1
1 1641
Hi Brian,

The OleDb provider (used by AccessDataSource) uses ordered parameters, not named parameters. Also, because you have @Org quoted in
FilterExpression it's being used as a string literal. Try naming your parameter OrgParam and using it as is, without a prefix or
quotes directly in a WHERE clause of your query:

SELECT Orgs.Org
[...]
WHERE Org = OrgParam

The details grid should be hidden, by default, until the page is posted back when the user selects a master grid row and if there is
at least one child record to be displayed.

--
Dave Sexton

<br**********@wpafb.af.milwrote in message news:11*********************@p79g2000cwp.googlegro ups.com...
I'm trying to link a gridview to another gridview in a Master-Details
architecture. But the Details list isn't filtering like it is
suppossed to. It will show all items on page load and it won't remove
any items when an item in the Masters list is selected. It shouldn't
show anything until an item in the Master's list is selected and then
only show the details which are associated with the selected item in
the Masters list.
I'm new to ASP.NET (one of the last straglers moving from VBScript)
and, so, I'm probably doing something pretty stupid, but some help
would be really appreciated.
Here's the code

<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile=""

SelectCommand="SELECT DISTINCT org FROM Orgs"
OnSelecting="AccessDataSource1_Selecting1"></asp:AccessDataSource>

<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False"

DataSourceID="AccessDataSource1" Style="z-index: 100; left:
6px; position: absolute;

top: 7px" DataKeyNames="org"
OnSelectedIndexChanged="GridView1_SelectedIndexCha nged"
BorderStyle="None" PageSize="20">

<Columns>

<asp:HyperLinkField DataNavigateUrlFields="org"
DataNavigateUrlFormatString="Details.aspx?field={0 }"

DataTextField="org" />

</Columns>

</asp:GridView>

<asp:AccessDataSource ID="AccessDataSource2" runat="server"
DataFile=""

OnSelecting="AccessDataSource2_Selecting1"
SelectCommand="SELECT Orgs.org, ThreeLetter.[position],
ThreeLetter.location, [user].Name, rights.Type FROM (((Orgs INNER JOIN
ThreeLetter ON Orgs.ID = ThreeLetter.Orgs_ID) INNER JOIN rights ON
ThreeLetter.officeKey = rights.officeKey) INNER JOIN [user] ON
rights.userKey = [user].userKey) ORDER BY Orgs.org"
FilterExpression="Org='@Org'">

<FilterParameters><asp:ControlParameter Name="Org"
ControlID="GridView1" PropertyName="SelectedValue"
/></FilterParameters>

</asp:AccessDataSource>

<asp:GridView ID="GridView2" runat="server"
AutoGenerateColumns="False" DataKeyNames="org,Name"

DataSourceID="AccessDataSource2" Style="z-index: 103; left:
115px; position: absolute;

top: 9px">

<Columns>

<asp:CommandField HeaderText="Edit Rights"
ShowEditButton="True" ShowHeader="True" />

<asp:BoundField DataField="position"
HeaderText="position" SortExpression="position" />

<asp:BoundField DataField="location"
HeaderText="location" SortExpression="location" />

<asp:BoundField DataField="Type" HeaderText="Type"
SortExpression="Type" />

</Columns>

</asp:GridView>

Jul 30 '06 #2

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

Similar topics

0
by: Cold Filtered | last post by:
Hi, I have a .master file page with the following in <head> <script src="javascript/common.js" type="text/javascript" /> This works fine for any .aspx files in the same directory as the...
1
by: Friso Wiskerke | last post by:
Hi All, We've got an VS.2003 ASPNET (VB) webproject which we would like to convert to VS.2005 so that we can make use of the Master Page feature. Converting the initial pages to 2005 is not such...
4
by: EagleRed | last post by:
I am writing an ASP.NET 2.0 application that uses more than one master page. Currently, there are two pages, Freedom1.master and Freedom2.master. I have no problems with Freedom1.master. However,...
3
by: fstenoughsnoopy | last post by:
Ok the complete story. I have a Contact Table, Query and Form, that are used to input and store the contact info for customers. They have FirstName, LastName and Address as the primary key...
0
by: Michel Laurent | last post by:
Hi, I can't catch the menuitemclick event on a master page. Working with VS2005.net, having a Menu1_MenuItemClick method that handles menuitemclick event and having declared in the aspx code the...
2
by: sj | last post by:
I am just learning to use Tkinter and am having problems displaying image files. I am able to display an image using tutorials (such as http://www.daniweb.com/code/snippet296.html) But when I try...
3
by: Jeff | last post by:
Hey! ASP.NET 2.0 I have a webpage which is based on a nested master page. The problem is that I've applied a theme to the webpage but the CSS settings isn't applied to the panes.... As you...
8
sonic
by: sonic | last post by:
I am having trouble passing two variable types into my printPattern function. I need to pass rows and characterSelect from my getInput function into my printPattern function. I keep getting a...
2
by: Dave | last post by:
It seems that if I put just html inside a master page, everything works fine. But if I put other controls (such as WebControls and/or my own custom controls), I can't seem to access the content...
3
by: Bobby Edward | last post by:
I had a simple admin form for "Categories"... Details View: To INSERT new Category Grid View: To View, Edit and Delete all Categories I decided to put the INSERT Details View inside of a...
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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.