|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
TabStrip/Multipage using UserControl (.ascx) contained within a UserControl(.ascx)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 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 Show quoteHide quote > 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 > 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.
Adding Event Handler to Dynamically added Controls
Copy Paste label textbox aspx code Datalist and LoadTemplate Weird "defined in multiple places" error Referencing to .ascx Form Post Back in ASP.Net 1.1 How do I transfer a value from a Querystring (codebehind) to a JavaScript function? How do I set the value of a checkbox on my repeater control? ASP.NET project and Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET How to get the file's name after click the Browse... in HtmlInputFile |
|||||||||||||||||||||||