I've been trying to come up with a way to use the built in ASP.NET
controls to design something that displays the results of a database
query by group like is possible in an Access report to, for example,
display a list of managers and all of their employees. For example:
Type 1
Column 1, Column 2, Column 3
Column 1, Column 2, Column 3
Column 1, Column 2, Column 3
Type 2
Column 1, Column 2, Column 3
Column 1, Column 2, Column 3
Column 1, Column 2, Column 3
Type 3
Column 1, Column 2, Column 3
Column 1, Column 2, Column 3
Column 1, Column 2, Column 3
[...]
So far, I have come up short on ideas to implement this cleanly using
the ASP.NET controls. A friend of mine suggested a Repeater with
another Repeater nested inside of it; however, it just didn't seem like
a clean way.
I've considered developing my own custom server control that extends the
CompositeDataBo undControl class, but even doing this, I couldn't think
of a clean way of doing it without requiring two DataSource properties
(one for the Managers and another for the Employees).
I'm sure others have run across a similar situation in the past; but, I
haven't had any luck locating any examples.
Does anybody have any suggestions?
Thank you in advance,
--
Sean 2 1321
Hey Sean,
I think the CompositeDataBo undControl is definitely the way to go- and
you don't need two datasource properties. The trick here is loose
casting in the CreateChildCont rol function. What you want to do is
enumerate through the datasource like you would do for a flat control,
and add a row or whatever container you wanted for that primary row in
the datasource. Then, when you have your enumerated element, you can
see if that implements the IList, IListSource, or the IEnumerable
interface. If it does, you can get an enumerator from that element and
loop it just like you were doing for the primary datasource. With this
secondary list you can build your sub grid.
You may want to add some properties to help the composite control find
the child controls in the datasource. Say, if the datasource is a
dataset you can add some props to help the CreateChildCont rol function
find relationships with datatables to access sub data.
Here's some psuedocode:
Enumerator ie = this.DataSource .GetEnumerator( );
foreach(element in ie)
{
row = BuildRow();
if(element is IEnumerator)
{
IEnumerator AnotherEnumerat or = element.GetEnum erator();
BuildTableInRow (row, AnotherEnumerat or); //This Builds the sub
table
}
senfo wrote:
I've been trying to come up with a way to use the built in ASP.NET
controls to design something that displays the results of a database
query by group like is possible in an Access report to, for example,
display a list of managers and all of their employees. For example:
Type 1
Column 1, Column 2, Column 3
Column 1, Column 2, Column 3
Column 1, Column 2, Column 3
Type 2
Column 1, Column 2, Column 3
Column 1, Column 2, Column 3
Column 1, Column 2, Column 3
Type 3
Column 1, Column 2, Column 3
Column 1, Column 2, Column 3
Column 1, Column 2, Column 3
[...]
So far, I have come up short on ideas to implement this cleanly using
the ASP.NET controls. A friend of mine suggested a Repeater with
another Repeater nested inside of it; however, it just didn't seem like
a clean way.
I've considered developing my own custom server control that extends the
CompositeDataBo undControl class, but even doing this, I couldn't think
of a clean way of doing it without requiring two DataSource properties
(one for the Managers and another for the Employees).
I'm sure others have run across a similar situation in the past; but, I
haven't had any luck locating any examples.
Does anybody have any suggestions?
Thank you in advance,
--
Sean
Michael Hamrah wrote:
Hey Sean,
I think the CompositeDataBo undControl is definitely the way to go- and
you don't need two datasource properties. The trick here is loose
casting in the CreateChildCont rol function. What you want to do is
enumerate through the datasource like you would do for a flat control,
and add a row or whatever container you wanted for that primary row in
the datasource. Then, when you have your enumerated element, you can
see if that implements the IList, IListSource, or the IEnumerable
interface. If it does, you can get an enumerator from that element and
loop it just like you were doing for the primary datasource. With this
secondary list you can build your sub grid.
You may want to add some properties to help the composite control find
the child controls in the datasource. Say, if the datasource is a
dataset you can add some props to help the CreateChildCont rol function
find relationships with datatables to access sub data.
Here's some psuedocode:
Enumerator ie = this.DataSource .GetEnumerator( );
foreach(element in ie)
{
row = BuildRow();
if(element is IEnumerator)
{
IEnumerator AnotherEnumerat or = element.GetEnum erator();
BuildTableInRow (row, AnotherEnumerat or); //This Builds the sub
table
}
Hi Michael,
Thank you very much for the response. I've been busy at work with my
primary job (this question was in reference to a side project), so I
haven't had an opportunity to try to implement it, yet.
I think I have an idea of what you're suggesting, but I won't find out
for sure until this evening or tomorrow evening. I'll definitely write
back if I have any follow-up questions.
Thank you again,
--
Sean This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: AbeR |
last post by:
I'm an intermediate/novice (I've probably developed a half dozen ASP.NET apps
at this point) ASP.NET C# developer at this point and am totally strumped by
a client's setup.
I am developing this for a client's intrnet. On my client's server (Windows
2000 Terminal Server with ASP.NET v1.14322) I can't get any of the WebForm
controls to render except for Label and (Web Form TextBox, RadioButtonList,
Button, LinkButton all don't render)
...
|
by: aboycalled3 |
last post by:
I'm interested in using the fascinating CSS available at
http://www.moronicbajebus.com/playground/cssplay/reformat-table/
which allows one to present tabular data in a way that's more appealing
to the eye (at least to my eye it's more appealing :^)
To my mind this is very much what CSS is all about: allowing content
providers to present properly coded data in a way they and, ideally,
their readers, find inviting and accessible....
|
by: Lau Lei Cheong |
last post by:
Hello,
I'm writing a web page using ASP.NET that with send the page's HTML
content to user through e-mail. My plan is to dump the content to a file
then email it to user as attachment.
The following the part of the code I used:
StreamWriter MyWriter = myfile.CreateText();
MemoryStream renderedPage = new MemoryStream(10240);
|
by: Frank |
last post by:
Hi all,
I want to derive a class from DataGrid so that I can have
a label on the top.
But when I tried to add the control to my form, I got an
error "Specified cast is not valid" on the line:
MyBase.Render(w) in the Render function.
Thanks a lot.
Frank
|
by: Darren Clark |
last post by:
I am trying to work out how to change some values of data during
itemdatabound.
MSDN states that the ItemDataBound is called BEFORE the render... so any
changes do the data SHOULD work..
however ihave the following example... and it doesnt work at all... the
text CHANGE_Value does not come up at any time...
| |
by: WT |
last post by:
Hello,
I recently discovered that Page.Render is doing special things concerning
the Menu navigation control.
When I was using my own Render override, menus were not working, maybe some
style missing, or some javascript not loaded.
Any information welcome as I need to do some special work in Render.
CS
|
by: Raghu |
last post by:
Hi All,
I am building Report application using ASP.Net and C#. The report will
be shown to the user in aspx page. The report inputs are taken at
runtime like columns user wants to see and filters user wants to be
applied. I am using Analysis Services 2000 to get data. Basically it
uses OLAP database to get the data.
There are performance issues both at OLAP level and ASP.Net.
|
by: SteveM |
last post by:
I am sure this is an easy question, but being relatively new to ASP.NET
programming, I can not quite grasp what I need to accomplish what I
need to do.
What I have is a word document that is rendered as a page (or actualy a
part of a page) that is editiable. To do this I let the user download
the document, edit it and then upload it back to the site. Then at
Page_Open, I convert the .doc file to an html and render it back to the
page......
|
by: Bob Jones |
last post by:
Here is my situation:
I have an aspx file stored in a resource file. All of the C# code is
written inline via <script runat="server"tags. Let's call this page
B. I also have page A that contains some javascript code that calls
window.open. I pass the resource url of page B to Page A's window.open
call. Page B is then loaded and executed but none of the server-side
code is rendered. If I view the source of the page, the code (and page...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
| |
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |