S
Sam
Hi,
I write my code behind in C# and everytime I need a new functionality, I
build a class for it and save it in a folder I call ClassLibrary.
My question is I don't know how to send my web controls to these classes.
For example, I created a standard States and Countries class which simply
gets a list of all US states and countries in the world from the database.
This took care of getting the necessary data from the database but I still
write a lot of repetitive code because I want to bind the data to the
specific DropDownList controls I use on my ASPX page. My classes are still
pretty useful as they go fetch the data for me but I realize that I'm not
using classes to their full potential.
Someone once told me that I could pass my DropDownList control to my class
and let the class, populate it, bind it to the control and whatever else I
need to do and return it to the ASPX page all ready to be used.
I'd appreciate some simple code samples or a pointer to a web page someone
already created so that I can see how this is done. Thanks for all your
help.
Thanks,
Sam
I write my code behind in C# and everytime I need a new functionality, I
build a class for it and save it in a folder I call ClassLibrary.
My question is I don't know how to send my web controls to these classes.
For example, I created a standard States and Countries class which simply
gets a list of all US states and countries in the world from the database.
This took care of getting the necessary data from the database but I still
write a lot of repetitive code because I want to bind the data to the
specific DropDownList controls I use on my ASPX page. My classes are still
pretty useful as they go fetch the data for me but I realize that I'm not
using classes to their full potential.
Someone once told me that I could pass my DropDownList control to my class
and let the class, populate it, bind it to the control and whatever else I
need to do and return it to the ASPX page all ready to be used.
I'd appreciate some simple code samples or a pointer to a web page someone
already created so that I can see how this is done. Thanks for all your
help.
Thanks,
Sam