473,789 Members | 2,388 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

GridView and the Factory Pattern.


I'm working on a application where I have

1 page which shows a GridView.

I have this page working...with sorting, with paging...and I'm caching the
first resultset,... to avoid unnecessary db calls after the first db hit.

...

The page needs to be called ... for 3 different reasons.
What I means is that.... for one flow, the page shows up...and has columns
like
EmpID,LastName, FirstName,SSN

Another UI flow...has the same grid, except I don't want the SSN, but do
want DOB (date of birth)
EmpID,LastName, FirstName,DOB

A third flow... and I want HomeTown
EmpID,LastName, FirstName,HomeT own

(this is a generic example, fyi).

I thought about...instead of hacking a bunch of code together...to create my
GridView via code..and get an instance via a factory.
public GridView GetAGridView(st ring key)
{
GridView gv = new GridView();
gv.//Add Colors and such....the thing which are in common to all
returned GridViews

gv.Columns.Add( "EmpID");
gv.Columns.Add( "LastName") ;
gv.Columns.Add( "FirstName" );

switch(key)
{
case "SSN":
gv.Columns.Add( "SSN");//
break;
case "DOB":
gv.Columns.Add( "DOB");
break;
case "HomeTown":
gv.Columns.Add( "HomeTown") ;
break;
}

}
That code doesn't work..I'm just relaying the idea.

My questions are this:

A:
Can I programatically get access to each and every property of the GridView.
The Sorting, the Paging, the Header, the ItemTemplates.

A2. Anybody have a link to something like this..an example?

B:
I think I need to write up my handlers...in the codebehind of the aspx page.
Aka, it makes more sense to have the "_Sorting" handler coded in the code
behind page.

C:
Anyone see any flaws in this model, minus the lack of "WYSIWYG" development.
(Aka, its harder to code up a good looking GridView via code..then to set
properties and see the immediate results in the IDE.
...
Thanks,
Sloan


Feb 27 '06 #1
0 932

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

Similar topics

17
6646
by: Medi Montaseri | last post by:
Hi, Given a collection of similar but not exact entities (or products) Toyota, Ford, Buick, etc; I am contemplating using the Abstraction pattern to provide a common interface to these products. So I shall have an Abstract Base called 'Car' implemented by Toyota, Ford, and Buick. Further I'd like to enable to client to say Car *factory;
2
2980
by: Ryan Mitchley | last post by:
Hi all I have code for an object factory, heavily based on an article by Jim Hyslop (although I've made minor modifications). The factory was working fine using g++, but since switching to the Intel compiler it has stopped working. I think the singleton pattern static instance thing may be at the root of the problem, but I'm not sure. I had to add calls to instance() in regCreateFn, which gets the behaviour more in line with what I was...
2
1585
by: max | last post by:
Hello, I analyze this design pattern for a long time but I do not understand how this pattern work and what the purpose is? (I looked a this site http://www.dofactory.com/Patterns/PatternAbstract.aspx). Could anybody try to explain me in his own words how this pattern work and what the purpose is? thanks in advance
5
1366
by: CSharper | last post by:
I have created a Factory pattern code. One thing I noticed after coding, each factory has some methods they are exactly same and doing the same code using the values specific to each factory, if I would refactor the code and make it a seperate class and use the class in each factory then the code look look and more DRY. My question is what is the right way to do this in Factory Pattern. Refactoring them into a seperate class is a solution?...
0
9506
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10404
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10193
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 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...
0
9979
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 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...
0
9016
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, 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...
1
7525
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5548
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4089
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
3
2906
bsmnconsultancy
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...

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.