controls are not recognized in a class file

  • Thread starter Thread starter ruthiefy
  • Start date Start date
R

ruthiefy

Hi,

I need a few sql queries results so I created a new class with has a
few functions that load the data.
After executing ExecuteReader, I need to load the data to the
dropdownlist control.
The problem is that the control isn't recognized in the new class
(recognized only in Default.aspx.vb) -none of the controls of
default.aspx is recognized in the new class.

Any idea?
What am I missing?

Thanks.
Ruthie.
 
Controls belong to the page. The new class knows nothing about the page.

Mixing controls with data access code in the same class is not a good idea.
A better solution is to get the methods of the class return data access
objects like datareaders, datatables, datasets, leave all the controls on
the page and databind the controls to the objects returned from the class.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
 
Controls belong to the page. The new class knows nothing about the page.

Mixing controls with data access code in the same class is not a good idea.
A better solution is to get the methods of the class return data access
objects like datareaders, datatables, datasets, leave all the controls on
the page and databind the controls to the objects returned from the class.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net




I need a few sql queries results so I created a new class with has a
few functions that load the data.
After executing ExecuteReader, I need to load the data to the
dropdownlist control.
The problem is that the control isn't recognized in the new class
(recognized only in Default.aspx.vb) -none of the controls of
default.aspx is recognized in the new class.
Any idea?
What am I missing?
Thanks.
Ruthie.- Hide quoted text -

- Show quoted text -

Thanks Eliyahu.
Your answered my question.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top