UserControl

P

Peter Kirk

Hi

I have an ascx: a web page + code behind. In the code behind I generate
several lists (generated from a database) which are displayed on the page.

When a user clicks on an item from one of the lists I have to perform a new
database search, and present another page.

One question is, is the "code behind" instance associated with a particular
browser session? That is, is it safe to have "global variables" in the code
behind. Actually as I write this I guess it must be, because the GUI
controls on the page are global and maintain their state unaffected by other
browser sessions.

Another question is, when the user clicks on an item in one of the lists,
and thereby comes to another page with other data, I would like to keep the
data from the particular list he clicks on (without having to fetch the list
data again from the database). Is it possible to pass a list to another
"ascx"?

Thanks,
Peter
 
K

Khaled Hussein

Hello Peter,
Regarding the first question: I guess yes it is safe to have "global variables"
it does make sense although I am not quite sure of this, I mean I havn't
tried it on my own before.

Regarding the second question: Yes you can pass the same list to another
ascx file, just make another function in the other ascx control and pass
it the list that you want to have.

Thanks
--
Khaled Hussein
Graduate Teaching Assistant
College of Computing and Information Technology
Arab Academy for Science and Technology and Maritime Transport
Web Site: http://www.aast.edu
(The power of imagination makes us infinite.)
 
A

Annie

Depends, on how you are using the .ascx file ... as there is no details
however you can
use the ascx as an attachment eg side menu, header, footer or side bar to
any other page
so you don't need to pass the list from one ascx to another.

I don't know if it makes sense
 
P

Peter Kirk

Annie said:
Depends, on how you are using the .ascx file ... as there is no details
however you can
use the ascx as an attachment eg side menu, header, footer or side bar to
any other page
so you don't need to pass the list from one ascx to another.

I don't know if it makes sense

Yes, I see what you mean. (I am still quite new using .net).

There is an "aspx". On this are several "ascx" controls (is it correct to
call an ascx a "control"?).
Eg. a left menu ascx, a top ascx, and various content ascxs. I am making one
of the content ascxs (actually 2, where the first leads to the second).

My first ascx displays several lists of data - which are overall
descriptions of various routes from one port to another port.

The user can click one one of the routes and should then be presented with a
detailed breakdown of the route - showing all the ports called at, dates,
times, places where cargo is transferred to another ship for example. This
detailed breakdown should be presented on a separate content ascx from the
first ascx. I want to know if I can pass the data from the list the user
clicked on (ie pass all the items in the list) to the second ascx.

Thanks,
Peter
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top