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

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?

Advertisements

> 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
>

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.

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.

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!