Hi
I thought I would try a hashtable for storing key and title value
pairs. For instance,
public class MyBasePAgeClass
{
Hashtable TitleHash = new Hashtable();
........
private void Page_Load(object sender, System.EventArgs e)
{
TitleHash.Add("home","Home");
TitleHash.Add("dbs","Create / Drop Databases");
.........
Then, later on, I evaluate the key (sent back when next page is
requested).
if (key ="dbs") then display the title
"Create / Drop Databases", etc..
This is a web app (asp/c#).
I am using 1 aspx.cs file as a base class for all my other web pages.
It contains common functions, etc..
So, I declare and populate the table in the base class and therefore
it is accessible to all web pages. Now, this means that the table has
to be rebuilt everytime a post is made and a new page generated.
1) Is this the best way to make a structure like this available to all
web pages?
There will probably be around 15 or 20 entries.
Is there a benefit to using hashTable over 2D string array or would an
array be better?
Thanks
Trying to improve
Jeff 4 1449
Jeff User wrote: Hi I thought I would try a hashtable for storing key and title value pairs. For instance,
What exactly is your question?
- is it wether what you're doing is the best way or if there's a better
one? (judging by the text)
- is it wether Hashtable is actually doing what its supposed to do?
(judging by the subject of the post)
What exactly is the problem you're trying to solve? It would help to
know more about what you're doing before a definite answer can be given.
The best answer I can give from your current problem "description" is
"it depends".
--
Lasse Vågsæther Karlsen http://usinglvkblog.blogspot.com/
mailto:la***@vkarlsen.no
PGP KeyID: 0x2A42A1C2
Jeff,
It "sounds" like from what you are saying that you assume a Hashtable in a
MasterPage class is static, and that is not necessarily true.
You could certainly add a static Hashtable to your Global class, and it
would be available from all pages, or you can use Session or Cache, whichever
better suits your business logic. With only 15 or 20 items to store, it
really would not make much difference whichever you choose to use.
Peter
--
Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
"Jeff User" wrote: Hi I thought I would try a hashtable for storing key and title value pairs. For instance,
public class MyBasePAgeClass { Hashtable TitleHash = new Hashtable(); ........ private void Page_Load(object sender, System.EventArgs e) { TitleHash.Add("home","Home"); TitleHash.Add("dbs","Create / Drop Databases"); .........
Then, later on, I evaluate the key (sent back when next page is requested). if (key ="dbs") then display the title "Create / Drop Databases", etc..
This is a web app (asp/c#). I am using 1 aspx.cs file as a base class for all my other web pages. It contains common functions, etc.. So, I declare and populate the table in the base class and therefore it is accessible to all web pages. Now, this means that the table has to be rebuilt everytime a post is made and a new page generated.
1) Is this the best way to make a structure like this available to all web pages?
There will probably be around 15 or 20 entries.
Is there a benefit to using hashTable over 2D string array or would an array be better?
Thanks Trying to improve Jeff
Sorry folks, The subject was not really correct for this post. I had
started out with a problem, solved it, and then was just wondering
about the issues that I listed. I forgot to change the topic.
Basically, as far as HashTable vs 2d array:
what are the benefits of one over the other? When to use which one?
And, the other Q was related to my means of having common code for all
web pages. Sorry, I guess this is a different topic, technically, but
it is what I am trying to do with the hash table.
Thanks again.
Jeff
On Sat, 26 Nov 2005 21:42:58 GMT, Jeff User <je*******@hotmail.com>
wrote: Hi I thought I would try a hashtable for storing key and title value pairs. For instance,
public class MyBasePAgeClass { Hashtable TitleHash = new Hashtable(); ....... private void Page_Load(object sender, System.EventArgs e) { TitleHash.Add("home","Home"); TitleHash.Add("dbs","Create / Drop Databases"); ........
Then, later on, I evaluate the key (sent back when next page is requested). if (key ="dbs") then display the title "Create / Drop Databases", etc..
This is a web app (asp/c#). I am using 1 aspx.cs file as a base class for all my other web pages. It contains common functions, etc.. So, I declare and populate the table in the base class and therefore it is accessible to all web pages. Now, this means that the table has to be rebuilt everytime a post is made and a new page generated.
1) Is this the best way to make a structure like this available to all web pages?
There will probably be around 15 or 20 entries.
Is there a benefit to using hashTable over 2D string array or would an array be better?
Thanks Trying to improve Jeff
Sorry folks, The subject was not really correct for this post. I had
started out with a problem, solved it, and then was just wondering
about the issues that I listed. I forgot to change the topic.
Basically, as far as HashTable vs 2d array:
what are the benefits of one over the other? When to use which one?
And, the other Q was related to my means of having common code for all
web pages. Sorry, I guess this is a different topic, technically, but
it is what I am trying to do with the hash table.
Thanks again.
Jeff
On Sat, 26 Nov 2005 21:42:58 GMT, Jeff User <je*******@hotmail.com>
wrote: Hi I thought I would try a hashtable for storing key and title value pairs. For instance,
public class MyBasePAgeClass { Hashtable TitleHash = new Hashtable(); ....... private void Page_Load(object sender, System.EventArgs e) { TitleHash.Add("home","Home"); TitleHash.Add("dbs","Create / Drop Databases"); ........
Then, later on, I evaluate the key (sent back when next page is requested). if (key ="dbs") then display the title "Create / Drop Databases", etc..
This is a web app (asp/c#). I am using 1 aspx.cs file as a base class for all my other web pages. It contains common functions, etc.. So, I declare and populate the table in the base class and therefore it is accessible to all web pages. Now, this means that the table has to be rebuilt everytime a post is made and a new page generated.
1) Is this the best way to make a structure like this available to all web pages?
There will probably be around 15 or 20 entries.
Is there a benefit to using hashTable over 2D string array or would an array be better?
Thanks Trying to improve Jeff This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: francois |
last post by:
Hi,
I have a webservice that I am using and I would like it to return an XML
serialized version of an object.
the class of the object is defined serializable as the following:
public...
|
by: francois |
last post by:
First of all I would to to apologize for resending this post again but I
feel like my last post as been spoiled
Here I go for my problem:
Hi,
I have a webservice that I am using and I would...
|
by: mnmnm1951 |
last post by:
I am working with Sharepoint Services and am trying to add the
fileversion Metadata to the Versions.aspx page using the example from
the SDK. I have not done much with hashtables but it all looks...
|
by: D. Shane Fowlkes |
last post by:
I've been reading up on Arrays in ASP.NET. I'm going to create an two
dimensional array of some type to contain 5 columns but a variable amount of
rows. I read up on the ArrayList function and...
|
by: SK |
last post by:
Hey,
i have a hashtable, where I am adding some values. Now
when I iterate through them then they start in reverse
order, why is that happening and how can I get rid of it?
Thanks
|
by: Scott M. Lyon |
last post by:
I'm working on using the COM Interop wrapper on an existing .NET library, to
allow existing VB6 applications to call the .NET code.
And I've been able to get it working in a basic sense (I can...
|
by: Ivan |
last post by:
is it possible to make a universal hashtable that would be able to serialize itself to xml format?
universal one, meaning I don't have to know about the type of keys and values in advance.
Ivan
|
by: nithya4u |
last post by:
Hi All,
Currently, am working on converting some part of C# code to JAVA. Am
having a problem with respect to the usage of Hashtable in C#. Is there
a java equivalent for it? I have searched lots...
|
by: Bruce |
last post by:
Hi
I am having a problem understanding the exact advantages of using an
ArrayList over a Hashtable in any situation.
In most areas of an application I am working on, lookup needs to be
fast. If I...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: giovanniandrean |
last post by:
The energy model is structured as follows and uses excel sheets to give input data:
1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
|
by: NeoPa |
last post by:
Hello everyone.
I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report).
I know it can be done by selecting :...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM)
Please note that the UK and Europe revert to winter time on...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
|
by: isladogs |
last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, Mike...
|
by: GKJR |
last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
|
by: SueHopson |
last post by:
Hi All,
I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...
| |