TabStrip/Multipage using UserControl (.ascx) contained within a UserControl(.ascx)

Discussion in 'ASP .Net Web Controls' started by shaileenpatel@yahoo.com, Apr 25, 2005.

  1. Guest

    Hi All,

    I need some help. This is a bit detailed and hopefully I explain it
    completely. Please let me know if you have any questions. I have
    successfully written an application in which I have a single main page
    (.aspx) and I switch User Controls(.ascx) on a panel control to
    represent the different pages of the application. Now I am trying to
    add an "Admin" User Control (.ascx) which contains a single drop-down
    list with some items from the database in it ( the values are IDs) and
    two constant items ("Select One" - value of -1 and "Add New" value of
    0). The "Admin" user control also contains TabStrip and MultiPage
    controls and would reference different User Controls (.ascx) as the
    different pageviews/tabs. This "Admin" user control sas been
    successfully implemented but the problem comes when changing selection
    in the drop-down list box. This is the way I believe it should work
    (please correct me if I am wrong)
    - Change the selection in drop down listbox from "Select One" to an
    item with a value
    - A postback to the server where I take the ID selected and set it to
    session variable
    - Then the tab control reads the session variable and retrieves
    information from the database based on ID in session and
    displays it on the tab.
    The problem is that the Tab User Controls loads before the parent
    "Admin" user control and so the tab controls is reading the id that
    selected on the previous trip not the current trip. For example,
    initial ID selected is -1 and then tab control reads the id as null.
    Then you selected ID of 2 , the tab control reads as -1. So the tab
    control is one step behind. Is there any way to change the order in
    which these controls are loaded or a manner in order to address this
    issue?

    Thanks in advance,

    Shay
     
    , Apr 25, 2005
    #1
    1. Advertising

  2. Brock Allen Guest

    You should post the smallest snippet of code that illustrates the problem.
    It's hard to tell without it.

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen



    > Hi All,
    >
    > I need some help. This is a bit detailed and hopefully I explain it
    > completely. Please let me know if you have any questions. I have
    > successfully written an application in which I have a single main page
    > (.aspx) and I switch User Controls(.ascx) on a panel control to
    > represent the different pages of the application. Now I am trying to
    > add an "Admin" User Control (.ascx) which contains a single drop-down
    > list with some items from the database in it ( the values are IDs) and
    > two constant items ("Select One" - value of -1 and "Add New" value of
    > 0). The "Admin" user control also contains TabStrip and MultiPage
    > controls and would reference different User Controls (.ascx) as the
    > different pageviews/tabs. This "Admin" user control sas been
    > successfully implemented but the problem comes when changing selection
    > in the drop-down list box. This is the way I believe it should work
    > (please correct me if I am wrong)
    > - Change the selection in drop down listbox from "Select One" to an
    > item with a value
    > - A postback to the server where I take the ID selected and set it to
    > session variable
    > - Then the tab control reads the session variable and retrieves
    > information from the database based on ID in session and
    > displays it on the tab.
    > The problem is that the Tab User Controls loads before the parent
    > "Admin" user control and so the tab controls is reading the id that
    > selected on the previous trip not the current trip. For example,
    > initial ID selected is -1 and then tab control reads the id as null.
    > Then you selected ID of 2 , the tab control reads as -1. So the tab
    > control is one step behind. Is there any way to change the order in
    > which these controls are loaded or a manner in order to address this
    > issue?
    >
    > Thanks in advance,
    >
    > Shay
    >
     
    Brock Allen, Apr 25, 2005
    #2
    1. Advertising

  3. Guest

    Here is a snippet from the parent Admin User Control.

    private void lstDocumentSet_SelectedIndexChanged(object sender,
    System.EventArgs e)
    {
    mobjUserInfo.CurrentDocumentSet =
    Int32.Parse(lstDocumentSet.SelectedValue);
    Session["UserSessionInfo"] = mobjUserInfo;
    }

    This SelectedIndexChanged event for a listbox on this control that
    contains two default values ("Select One" : -1, "Add New" : 0) and a
    list of Document Sets with their related IDs as values. When loaded
    from the Page_Load event, the listbox is defaulted to "Select One".

    Here is a snippet code from Tab 1 user control contained within the
    parent Admin user control.

    private void EvaluateDocumentSet()
    {
    switch(mobjUserInfo.CurrentDocumentSet)
    {
    //"Select One" selection in the parent
    Admin user control
    case -1:
    txtDSName.Text = "";
    txtDSName.Enabled = false;
    txtDSDescription.Text = "";
    txtDSDescription.Enabled = false;
    txtDSExpireDate.Text = "";
    txtDSExpireDate.Enabled = false;
    reqDSName.Enabled = false;
    reqDSDescription.Enabled = false;
    reqDSExpireDate.Enabled = false;
    btnShowCalendar.Enabled = false;
    btnShowCalendar.Style.Add("CURSOR",
    "DEFAULT"); btnSaveDS.Enabled = false;
    break;
    //"Add One" selection in the parent
    Admin user control
    case 0:
    txtDSName.Text = "";
    txtDSName.Enabled = true;
    txtDSDescription.Text = "";
    txtDSDescription.Enabled = true;
    txtDSExpireDate.Text = "";
    txtDSExpireDate.Enabled = true;
    reqDSName.Enabled = true;
    reqDSDescription.Enabled = true;
    reqDSExpireDate.Enabled = true;
    btnShowCalendar.Enabled = true;
    btnShowCalendar.Style.Add("CURSOR", "HAND");
    btnSaveDS.Enabled = true;
    btnSaveDS.CommandArgument = "ADD";
    break;
    //A document set is selected in the
    parent Admin user control
    default:
    GetDocumentSetInfo(mobjUserInfo.CurrentDocumentSet);
    txtDSName.Enabled = false;
    txtDSDescription.Enabled = true;
    txtDSExpireDate.Enabled = true;
    reqDSName.Enabled = true;
    reqDSExpireDate.Enabled = true;
    reqDSDescription.Enabled = true;
    btnShowCalendar.Enabled = true;
    btnShowCalendar.Style.Add("CURSOR", "HAND");
    btnSaveDS.Enabled = true;
    btnSaveDS.CommandArgument = "UPDATE";
    break;
    }
    }

    This method is called from the Page_Load method of the Tab 1 user
    control to evaluate the value of the Document Set ID saved to Session
    by the parent Admin user control. So what I am seeing is that the Tab 1
    user control is being loaded before the parent Admin user control. When
    is the page is first loaded, the value of the Document Set ID is
    evaluated as NULL and not -1(initial setting by parent Admin User
    Control) by Tab 1 user control. On the user's next selection from the
    listbox, Document Set ID is evaluated as -1 and not the value that was
    selected in the listbox. The evaluation is one step behind basically
    because the Tab 1 user control is loaded before the parent Admin user
    control. I hope clears things up. Please let me know if you any more
    questions or needs some clarification.
     
    , May 3, 2005
    #3
    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. Stephen Miller
    Replies:
    2
    Views:
    458
    Stephen Miller
    Feb 29, 2004
  2. Blair Taylor
    Replies:
    1
    Views:
    357
    Alvin Bruney
    Aug 7, 2003
  3. David

    How can i use tabstrip without using multipage?

    David, Jun 9, 2004, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    231
    David
    Jun 9, 2004
  4. Russ
    Replies:
    8
    Views:
    231
  5. Keith McDonald
    Replies:
    3
    Views:
    107
    Keith McDonald
    Jan 11, 2006
Loading...

Share This Page