UserControl

Discussion in 'ASP .Net Web Controls' started by Peter Kirk, Nov 1, 2005.

  1. Peter Kirk

    Peter Kirk Guest

    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
     
    Peter Kirk, Nov 1, 2005
    #1
    1. Advertising

  2. 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.)

    > 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
     
    Khaled Hussein, Nov 1, 2005
    #2
    1. Advertising

  3. Peter Kirk

    Annie Guest

    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


    "Peter Kirk" <> wrote in message
    news:%...
    > 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
    >
     
    Annie, Nov 1, 2005
    #3
  4. Peter Kirk

    Peter Kirk Guest

    "Annie" <> skrev i en meddelelse
    news:43674aa1$...
    > 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
     
    Peter Kirk, Nov 1, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. huobazi
    Replies:
    1
    Views:
    700
    David Waz...
    Jul 3, 2003
  2. Rajesh Tiwari

    Can we use a usercontrol inside a usercontrol

    Rajesh Tiwari, Aug 12, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    424
    Rajesh Tiwari
    Aug 12, 2003
  3. nail
    Replies:
    0
    Views:
    1,550
  4. Phl
    Replies:
    2
    Views:
    534
    =?Utf-8?B?VGFtcGEgLk5FVCBLb2Rlcg==?=
    Nov 18, 2004
  5. Fabiano
    Replies:
    2
    Views:
    608
    =?Utf-8?B?c3Jpbmk=?=
    Jun 3, 2005
Loading...

Share This Page