Link to home
Start Free TrialLog in
Avatar of chrismerritt
chrismerritt

asked on

Gridview to select from "Parent" into "Child" elements

Hi all,

Answered my fair share of questions in my time mostly in the PowerShell zone, but I am in need of help on something I am not so familiar with! :)

Basically I have some tables in a SQL 2008 Database that are interlinked, consider the attached image which shows how my tables link together.

In the long run though I consider the subscriptions table the parent table. The exch_mailboxes table is the child table and they link together via the exch_domain_services table.

The accounts table has a one to many relationship to the subscriptions table and I included it just so for searching purposes we may be able to search by name instead of subscription ID. The exch_mailboxes_addresses table just lets us pull back email addresses for users.

What I would like to do is have users search for a subscription (accounts may have multiple subscriptions) using the accounts/subscription tables, and then select a subscription, and then be taken into the child elements which will contain the exchange users that belong to that subscription.

I will then worry about letting people make adjustments from that point, but first things first I need to get this working.

I am using ASP.NET C# as my coding language, and I have Visual Studio 2010 which I am somewhat familiar with.

My experience so far has been using Datasets with TableAdapters, SQL stored procs and the GridView controls so those I am familiar with, if it's possible to carry on using those for this it would probably make things easier for me.

I am not afraid to use the codebehind pages for things but less familiar with that than using the GUI for the controls like I have been using.

Any help appreciated!

Thanks,
Chris nBUNs.png
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

I don't quite see a question.  What would you like to do with the GridView?
Avatar of chrismerritt
chrismerritt

ASKER

To cut a long story short, I would like a gridview that is populated with subscription data (from the subscriptions table in my screenshot) to be selectable.

When a subscription is selected another gridview becomes populated with the child elements of that subscription (these are the values form the exch_mailboxes table).

These child elements ideally would be editable en masse via checkboxes or similar.

Does this make more sense?
Hi Chris...

Basically there are two ways to use a gridview: wizard or manual.  The wizard is a fast way from the design screen in VS to create a gridview real fast without using code...
In Visual Studio after you create or after you create a web site or open a web site...drag a gridview from the toolbox onto the
 web form and use the smart tag to reference whatver you datasource you want, you can custom your query..

See this link for more details...FYI, the manual way is so you can use a pure code solution fro absolute control.
http://msdn.microsoft.com/en-us/library/aa479341.aspx

this specifically in the link:
To add any of the data source controls to an ASP.NET page, simply drag them from the Visual Studio 2005 Toolbox onto the appropriate ASP.NET Web page's Design view. Once you do this, the control's Smart Tag will appear with an option titled "Configure Data Source." Choosing this option will launch a wizard that prompts for the requisite information.
Sorry GlobalLevel I don't think you understood my question totally, I am fine with adding data sources to gridviews via the table adapters, what I am not sure about is how I can go about selecting data from one gridview and then utilising this to fill another gridview or similar.

Think of it like this, you have a ticketing system for a support desk, and you want to be able to browse from a particular company into all tickets belonging to that company.

What I would like to be able to do is select the company in the first grid view, then when selected a second gridview/detailsview gets populated with all the tickets belonging to the company I selected just now.

Does this make sense?
That sounds like you want to use a control parameter for a second data source that is bound to a child GridView/DetailsView.
Hi LearnedOne,

Sorry for delay in getting back to you, i've been pretty busy.

That does sound right, but unfortunately for me I have no idea how to begin with this to be perfectly honest, any chance you could post me a simple example or some sample code or something to get me started?
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I'm not totally convinced this question ever got answered to my satisfaction. But I can't open a new question until this one is marked as answered, and despite EE emailing me telling me my question was going to be automatically closed it never actually did get closed. So I am going to mark it as answered anyway.