473,385 Members | 1,661 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,385 software developers and data experts.

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,HomeTown

(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(string 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 910

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

Similar topics

17
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....
2
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...
2
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...
5
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.