WebUserControl State

G

Guest

Dear Friends,

I have a decision to make and hope to get some insight: I have built
several WebUserControls one of which is a WebUserControl that queries an SQL
server database, retrieves a filename and loads an image control. The
WebUserControl itself contains an SQLDataSource and an image box. I also
have other WebUserControls that implement the same concept as previously
mentioned.

The SQLDataSource is bound to a session variable (PictureID - Image
path and filename retrieved from SQL server) which works correctly from
within my ASP.NET application. This works in part because when a user logs
into my ASP.NET application, I query an SQL database table and set up all my
session variables (PictureID, PatientID, etc...). The problem is as follows:

I also use this WebUserControl in another page which is accessed from a
URL and NOT my ASP.NET application. Therefore, there are no session
variables initialized as the user is anonymous (non-authenticated). Thus, my
image does not load because the SQLDataSource cannot bind itself to a session
variable that does not exist or is nothing.

What I would like to do is pass this image path and filename from the
base/parent page to the WebUserControl, and perform a hard select instead of
tying the SQLDataSource to a session variable. Is this good practice or is
there a better way. Usually, its WebUserControls that raise events to the
base/parent form, and not the other way around which is what I am thinking of
right now. Any ideas?

Regards,

GiovanniP
 

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

Staff online

Members online

Forum statistics

Threads
473,992
Messages
2,570,220
Members
46,805
Latest member
ClydeHeld1

Latest Threads

Top