473,382 Members | 1,424 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,382 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. {
  3.  
  4. string MainType = myDS.Tables[0].Rows[Num]["Jewel_Main_Type_Name"].ToString(); 
  5. LinkButton lb_main = new LinkButton();
  6.  
  7. lb_main.Style["Position"] = "Absolute"; 
  8. lb_main.Style["Top"] = "" + Top + "px";
  9.  
  10. lb_main.Style["Left"] = "" + Left + "px";lb_main.Style["color"] = "blue"; 
  11. lb_main.Text = MainType;
  12.  
  13. lb_main.ID = "lb" + Num.ToString(); 
  14. p1.Controls.Add(lb_main);
  15.  
  16. lb_main.Click += new EventHandler(lb_main_Click);
  17.  
  18. HttpContext.Current.Session["UN"] = UserName; 
  19. }
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27. void lb_main_Click(object sender, EventArgs e) 
  28. {
  29.  
  30. LinkButton lb_Main = sender as LinkButton; 
  31. string MainType = lb_Main.Text;
  32.  
  33. string connstr = HttpContext.Current.Session["Connstr"].ToString(); 
  34. OleDbConnection myConn = new OleDbConnection(connstr);
  35.  
  36. string SqlGetSubByMain = "Select * from TBL_Jewel_Sub_Type where Jewel_Main_Type_ID=('" + MainType + "')"; 
  37. OleDbDataAdapter myAdapter = new OleDbDataAdapter(SqlGetSubByMain, myConn);
  38.  
  39. DataSet myDS = new DataSet(); 
  40. myAdapter.Fill(myDS);
  41.  
  42. HttpContext.Current.Session["MainType"] = lb_Main; 
  43. HttpContext.Current.Session["SubTypeByMainTypeDS"] = myDS;
  44.  
  45. if (lb_Main.ID != null) 
  46. {
  47.  
  48. HttpContext.Current.Response.Redirect("SubTypeIntro.aspx?UserName=" +HttpContext.Current.Session["UN"].ToString() + "&IsUserSigned=true"); 
  49. }
  50.  
  51. else HttpContext.Current.Response.Redirect("DeniedAccessForUnSignedCustomer.aspx"); 
  52. }
  53.  
  54.  
  55.  
  56. public void SubTypeIntro(DataSet myDS, Panel p1) 
  57. {
  58.  
  59. HttpContext.Current.Session["UN"] = UserName; 
  60. string SubType = myDS.Tables[0].Rows[Num]["Jewel_Sub_Type_Name"].ToString();
  61.  
  62. LinkButton lb_sub = new LinkButton(); 
  63. lb_sub.Style["Position"] = "Absolute";
  64.  
  65. lb_sub.Style["Top"] = "" + Top + "px"; 
  66. lb_sub.Style["Left"] = "" + Left + "px";
  67.  
  68. lb_sub.Style["color"] = "blue"; 
  69. lb_sub.Text = SubType;
  70.  
  71. p1.Controls.Add(lb_sub);
  72.  
  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. }
  75.  
  76. void lb_sub_Click(object sender, EventArgs e) 
  77. {
  78.  
  79. string UserName = HttpContext.Current.Session["UN"].ToString();
  80.  
  81. LinkButton lb_sub = sender as LinkButton; 
  82. HttpContext.Current.Session["SubType"] = lb_sub;
  83.  
  84. string lb_id = lb_sub.ID; 
  85. int sub_id = int.Parse(lb_id.Remove(0, lb_id.IndexOf('_') + 1));
  86.  
  87. string connstr = HttpContext.Current.Session["Connstr"].ToString(); 
  88. System.Data.OleDb.OleDbConnection myConn = new System.Data.OleDb.OleDbConnection(connstr);
  89.  
  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);
  92.  
  93. System.Data.DataSet myDS_name = new System.Data.DataSet(); 
  94. myAdapter_name.Fill(myDS_name);
  95.  
  96. HttpContext.Current.Session["NameBySubTypeDS"] = myDS_name;HttpContext.Current.Response.Redirect("JewelIntro.aspx?UserName=" +UserName + "&IsUserSigned=true"); 
  97.  
  98.  
  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 1348

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

Similar topics

1
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...
1
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...
6
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...
4
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...
7
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...
2
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...
9
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...
0
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...
6
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.