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

Modules?

I'm using ASP.Net and SQL Server 2000. I have a dropdown list that is used
across many of my ASP.Net pages. On those pages I have a dropdown list that
has the same name as all the others. Instead of make a connection, a dataset
etc.. on every page I would like to have that piece of code that can run on
all the pages by just calling it. Would this be a Special class or module.

Any ideas?

Thanks.

Big E
Nov 18 '05 #1
3 1006
"Big E" <no****@nospam.com> wrote in news:OLlG6BOcEHA.1152
@TK2MSFTNGP09.phx.gbl:
Would this be a Special class or module.


A user control maybe a better candidate.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 18 '05 #2
yes class, no modules (modules are not object orientated, avoid them if you care about this sort of thing)

Here is how to do this with codebehind.

What you can do is create a base class, that your current page will inherit, then this new class will inherit System.Web.UI.Page.

In this new baseclass, you can define your dropdownlist here, (take it out of the webdesigner code VS.net creates). You can also define any subs/functions you want to fill it here. Declare them as "Protected"

Then from your original codebehind pages, you just need to call these subs, and you've got it.

(Unfortunately doing it this way, though perfectly legal, will cause some bugs with visual studio to surface, the designer will still want to put the dropdownlist in the immediate code-behind file, I don't think there is anything you can do about this)

Hope this helps!
--Michael

"Big E" <no****@nospam.com> wrote in message news:OL**************@TK2MSFTNGP09.phx.gbl...
I'm using ASP.Net and SQL Server 2000. I have a dropdown list that is used
across many of my ASP.Net pages. On those pages I have a dropdown list that
has the same name as all the others. Instead of make a connection, a dataset
etc.. on every page I would like to have that piece of code that can run on
all the pages by just calling it. Would this be a Special class or module.

Any ideas?

Thanks.

Big E

Nov 18 '05 #3
"Raterus" <ra*****@spam.org> wrote in message
news:eA*************@TK2MSFTNGP12.phx.gbl...
yes class, no modules (modules are not object orientated, avoid them if you
care about this sort of thing)

Here is how to do this with codebehind.

What you can do is create a base class, that your current page will inherit,
then this new class will inherit System.Web.UI.Page.

In this new baseclass, you can define your dropdownlist here, (take it out
of the webdesigner code VS.net creates). You can also define any
subs/functions you want to fill it here. Declare them as "Protected"

Then from your original codebehind pages, you just need to call these subs,
and you've got it.

(Unfortunately doing it this way, though perfectly legal, will cause some
bugs with visual studio to surface, the designer will still want to put the
dropdownlist in the immediate code-behind file, I don't think there is
anything you can do about this)
----
I strongly recommend that you do not use a base class for this purpose. The
dropdownlist is the piece of code you want to re-use, not the page. Use a
user control or custom control to contain the dropdownlist functionality,
then reuse it on any page you like.
--
John Saunders
johnwsaundersiii at hotmail
Nov 18 '05 #4

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

Similar topics

2
by: Dave | last post by:
Hi Everyone, I am trying to import a package and then loop through the modules inside the package, but I'm running to a problem. Basically: ----- I have a package called...
0
by: Nick Coghlan | last post by:
Anyone playing with the CPython interpreter's new command line switch might have noticed that it only works with top-level modules (i.e. scripts that are directly on sys.path). If the script is...
15
by: Nick Coghlan | last post by:
Python 2.4's -m command line switch only works for modules directly on sys.path. Trying to use it with modules inside packages will fail with a "Module not found" error. This PEP aims to fix that...
7
by: Jorgen Grahn | last post by:
I have a set of tests in different modules: test_foo.py, test_bar.py and so on. All of these use the simplest possible internal layout: a number of classes containing test*() methods, and the good...
4
by: Misto . | last post by:
Hi folks! Short: There is a way to dumplicate a module ? I tried copy.deepcopy(module) but hangs with an error (also with standard modules ).. The only solution that I have by now is...
2
by: James Buchanan | last post by:
Hi group, I'm preparing Python 2.4.2 for the upcoming Minix 3.x release, and I have problems with make. configure runs fine and creates the makefile, but right at the end ends with an error...
7
by: Lauren Quantrell | last post by:
At running the risk of asking how big is too big... Is there a rule of thumb or a best practice that says I may have too many modules? I currently have a Access2K app with about 30 code modules,...
13
by: Robin Haswell | last post by:
Hey people I'm an experience PHP programmer who's been writing python for a couple of weeks now. I'm writing quite a large application which I've decided to break down in to lots of modules...
173
by: Zytan | last post by:
I've read the docs on this, but one thing was left unclear. It seems as though a Module does not have to be fully qualified. Is this the case? I have source that apparently shows this. Are...
3
by: Mohamed Yousef | last post by:
Hello , The problem I'm asking about is how can imported modules be aware of other imported modules so they don't have to re-import them (avoiding importing problems and Consicing code and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
0
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...

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.