Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2011-10-23
8
Medium Priority
?
270 Views
Last Modified: 2012-05-12
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
0
Comment
Question by:chrismerritt
  • 4
  • 3
8 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 37017435
I don't quite see a question.  What would you like to do with the GridView?
0
 
LVL 9

Author Comment

by:chrismerritt
ID: 37017775
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?
0
 
LVL 10

Expert Comment

by:GlobaLevel
ID: 37018492
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.
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
LVL 9

Author Comment

by:chrismerritt
ID: 37034855
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?
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 37035461
That sounds like you want to use a control parameter for a second data source that is bound to a child GridView/DetailsView.
0
 
LVL 9

Author Comment

by:chrismerritt
ID: 37122252
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?
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 1500 total points
ID: 37122796
Example:

ControlParameter Class
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.controlparameter.aspx

 <asp:sqldatasource
          id="SqlDataSource1"
          runat="server"
          connectionstring="<%$ ConnectionStrings:MyNorthwind%>"
          selectcommand="SELECT LastName FROM Employees WHERE Title = @Title">
          <selectparameters>
              <asp:controlparameter name="Title" controlid="DropDownList1" propertyname="SelectedValue"/>
          </selectparameters>
      </asp:sqldatasource>

Open in new window

0
 
LVL 9

Author Comment

by:chrismerritt
ID: 37829192
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.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question