473,224 Members | 1,540 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,224 software developers and data experts.

problem with masterpages and tabs while dynamically creating controls

My project is about jewellery. I have devided my jewelery into main types, which each one of them has sub types, and each one those sub types has the jewellery.

I have a tabcontainer. It includes tabpanels such as:Catalog,Terms,SiteMap.ViewCart ,etc. All the jewellery Intro is in the Catalog panel. when I first click the Catalog panel it Introduces me all the main types of the jewellery(It's all done dynamically from the cs file).The background has 2 regular empty panels in the both sides of the page. Then when you click any of those maintypes(which are linkbuttons) , i want the tabpanel to be updated and to show all the subtypes of that main type which you have clicked. iN ADDITION, I want the maintypes to appear in the right empty panel in the corner of the page - so the background is changed. (I remind you all this happens in the Catalog tabpanel). Then when you click on one of the subtypes links all the hewellery with the detalis and the images appear, and the panel in the corner still shows the main types! and all that still is in the Catalog panel. now look: when i click on other TablPanel, I want the panels that are in the corner to be empty again and not to show the main types.

There is another problem beacuse of which I really got confused:

I remind you that all the creation of the maintypes links, subtypes links and then the jewellery with the details, is all dynamically made through the code behind. I have tried to create the maintypes linkbuttons dynamically, and ofcourse added the click event and it worked. Cool. the problem is that in the click event of the maintype(which ias dynamically made) I ceate new linkbuttons and create their click events also dynamically of course. Here is the code:

Expand|Select|Wrap|Line Numbers
  1. public void MainTypeIntro(DataSet myDS, Panel p1) 
  2. {
  4. string MainType = myDS.Tables[0].Rows[Num]["Jewel_Main_Type_Name"].ToString(); 
  5. LinkButton lb_main = new LinkButton();
  7. lb_main.Style["Position"] = "Absolute"; 
  8. lb_main.Style["Top"] = "" + Top + "px";
  10. lb_main.Style["Left"] = "" + Left + "px";lb_main.Style["color"] = "blue"; 
  11. lb_main.Text = MainType;
  13. lb_main.ID = "lb" + Num.ToString(); 
  14. p1.Controls.Add(lb_main);
  16. lb_main.Click += new EventHandler(lb_main_Click);
  18. HttpContext.Current.Session["UN"] = UserName; 
  19. }
  27. void lb_main_Click(object sender, EventArgs e) 
  28. {
  30. LinkButton lb_Main = sender as LinkButton; 
  31. string MainType = lb_Main.Text;
  33. string connstr = HttpContext.Current.Session["Connstr"].ToString(); 
  34. OleDbConnection myConn = new OleDbConnection(connstr);
  36. string SqlGetSubByMain = "Select * from TBL_Jewel_Sub_Type where Jewel_Main_Type_ID=('" + MainType + "')"; 
  37. OleDbDataAdapter myAdapter = new OleDbDataAdapter(SqlGetSubByMain, myConn);
  39. DataSet myDS = new DataSet(); 
  40. myAdapter.Fill(myDS);
  42. HttpContext.Current.Session["MainType"] = lb_Main; 
  43. HttpContext.Current.Session["SubTypeByMainTypeDS"] = myDS;
  45. if (lb_Main.ID != null) 
  46. {
  48. HttpContext.Current.Response.Redirect("SubTypeIntro.aspx?UserName=" +HttpContext.Current.Session["UN"].ToString() + "&IsUserSigned=true"); 
  49. }
  51. else HttpContext.Current.Response.Redirect("DeniedAccessForUnSignedCustomer.aspx"); 
  52. }
  56. public void SubTypeIntro(DataSet myDS, Panel p1) 
  57. {
  59. HttpContext.Current.Session["UN"] = UserName; 
  60. string SubType = myDS.Tables[0].Rows[Num]["Jewel_Sub_Type_Name"].ToString();
  62. LinkButton lb_sub = new LinkButton(); 
  63. lb_sub.Style["Position"] = "Absolute";
  65. lb_sub.Style["Top"] = "" + Top + "px"; 
  66. lb_sub.Style["Left"] = "" + Left + "px";
  68. lb_sub.Style["color"] = "blue"; 
  69. lb_sub.Text = SubType;
  71. p1.Controls.Add(lb_sub);
  73. lb_sub.ID = "lb_" + int.Parse(myDS.Tables[0].Rows[Num]["Jewel_Sub_Type_ID"].ToString());lb_sub.Click += new EventHandler(lb_sub_Click); 
  74. }
  76. void lb_sub_Click(object sender, EventArgs e) 
  77. {
  79. string UserName = HttpContext.Current.Session["UN"].ToString();
  81. LinkButton lb_sub = sender as LinkButton; 
  82. HttpContext.Current.Session["SubType"] = lb_sub;
  84. string lb_id = lb_sub.ID; 
  85. int sub_id = int.Parse(lb_id.Remove(0, lb_id.IndexOf('_') + 1));
  87. string connstr = HttpContext.Current.Session["Connstr"].ToString(); 
  88. System.Data.OleDb.OleDbConnection myConn = new System.Data.OleDb.OleDbConnection(connstr);
  90. string all_name = "Select * from TBL_Jewel_Name where Jewel_Sub_Type_ID=" + sub_id + ""; 
  91. System.Data.OleDb.OleDbDataAdapter myAdapter_name = new System.Data.OleDb.OleDbDataAdapter(all_name, myConn);
  93. System.Data.DataSet myDS_name = new System.Data.DataSet(); 
  94. myAdapter_name.Fill(myDS_name);
  96. HttpContext.Current.Session["NameBySubTypeDS"] = myDS_name;HttpContext.Current.Response.Redirect("JewelIntro.aspx?UserName=" +UserName + "&IsUserSigned=true"); 
  99. }

What is the problem? The problem is that the whole thing is loaded in the page load- when you click the catalog tabpanel, and I followed the project while debugging and it skipped the subtype_click and didn't commit it... I have tried to solve this problem like this(I know it's a little hard to follow but please.. it's really important, and if something isn't clear tell me and i'll clarify my wish, thanks):

I created new aspx pages: SubTypeIntro.aspx and JewelIntro.aspx. There I set the same tabcontainer and etc.. and the Maintypes are shown in the "ORIGINAL ASPX" , then on the click event it goes to the SubTypeIntro page and there loads all the subtypes, and then on the subclick it goes to the JewelIntro Page... and there loads the jewels. It works greatlly and I have achieaved my target but it's very stupid in my opinion.. I use 2 masters for it and it's all really messed up.

As a conclusion: The main problem is how to solve the second problem without using the other pages and remaining in one aspx page in the same Catalog tabpanel.

If something isn't clear or if you got puzzled , please tell me and I will give you more details and even if you want my whole project. Please at least read my problems.. Anyway, THANK YOU for any kind of help or solutions... I don't know maybe my way is good but there is another one to arrange all that stuff.. So if you can help me somehow - It's my final project in ASP.NET in the highschool. Thanks.
Nov 17 '07 #1
0 1339

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Kamal Jeet Singh | last post by:
Hi Friends !! I am have facing problem in controlling the dynamically created controls on web page. The problem Scenario is Scenario:- My requirement is to load the web user controls on the...
by: Kamal Jeet Singh | last post by:
Hi Friends !! I am facing problem in controlling the dynamically created controls on web page. The problem Scenario is Scenario:- My requirement is to load the web user controls on the web...
by: Kenneth Keeley | last post by:
Hi, I have a Masterpage that controls the basic layout of the pages displayed on a web site. The masterpage also uses some variables. I would like to be able to access some of these variables from...
by: Larry Grady | last post by:
Anyone up for a challenge? I've been struggling with this for a few days and was hoping someone could help me. Pouring through all the messageboards I just can't find the solution. We have a...
by: Martijn Saly | last post by:
Hi there, I've created a master page with some controls on it, a Calendar control among others. Now depending on the date(s) selected, the content page needs to be updated. In the masterpage...
by: iturner100 | last post by:
Hi, I've been struggling with this one for a couple of hours without much joy. Basically, I've got a set of nested masterpages (3 as it happens). I'm dynamically generating a new page in code...
by: netasp | last post by:
hi all, how can I populate one aspx form when page is loading based on page ID? for example: loading page A (to search for VB code) would display labels and texboxes, dropdown lists all related...
by: Swami | last post by:
I have 2 questions relating to website design in asp .net: 1. In a website that I am building I have everything as a user control. Even the header, which contains the navigation tabs is in a user...
by: =?Utf-8?B?U3RlcGhlbiBIYXRmaWVsZA==?= | last post by:
I have two masterpages in a web application. One is used for the login and logout pages. The other is used for all other pages in the application. The difference between the two masterpages is...
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.