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
- public void MainTypeIntro(DataSet myDS, Panel p1)
- {
- string MainType = myDS.Tables[0].Rows[Num]["Jewel_Main_Type_Name"].ToString();
- LinkButton lb_main = new LinkButton();
- lb_main.Style["Position"] = "Absolute";
- lb_main.Style["Top"] = "" + Top + "px";
- lb_main.Style["Left"] = "" + Left + "px";lb_main.Style["color"] = "blue";
- lb_main.Text = MainType;
- lb_main.ID = "lb" + Num.ToString();
- p1.Controls.Add(lb_main);
- lb_main.Click += new EventHandler(lb_main_Click);
- HttpContext.Current.Session["UN"] = UserName;
- }
- void lb_main_Click(object sender, EventArgs e)
- {
- LinkButton lb_Main = sender as LinkButton;
- string MainType = lb_Main.Text;
- string connstr = HttpContext.Current.Session["Connstr"].ToString();
- OleDbConnection myConn = new OleDbConnection(connstr);
- string SqlGetSubByMain = "Select * from TBL_Jewel_Sub_Type where Jewel_Main_Type_ID=('" + MainType + "')";
- OleDbDataAdapter myAdapter = new OleDbDataAdapter(SqlGetSubByMain, myConn);
- DataSet myDS = new DataSet();
- myAdapter.Fill(myDS);
- HttpContext.Current.Session["MainType"] = lb_Main;
- HttpContext.Current.Session["SubTypeByMainTypeDS"] = myDS;
- if (lb_Main.ID != null)
- {
- HttpContext.Current.Response.Redirect("SubTypeIntro.aspx?UserName=" +HttpContext.Current.Session["UN"].ToString() + "&IsUserSigned=true");
- }
- else HttpContext.Current.Response.Redirect("DeniedAccessForUnSignedCustomer.aspx");
- }
- public void SubTypeIntro(DataSet myDS, Panel p1)
- {
- HttpContext.Current.Session["UN"] = UserName;
- string SubType = myDS.Tables[0].Rows[Num]["Jewel_Sub_Type_Name"].ToString();
- LinkButton lb_sub = new LinkButton();
- lb_sub.Style["Position"] = "Absolute";
- lb_sub.Style["Top"] = "" + Top + "px";
- lb_sub.Style["Left"] = "" + Left + "px";
- lb_sub.Style["color"] = "blue";
- lb_sub.Text = SubType;
- p1.Controls.Add(lb_sub);
- lb_sub.ID = "lb_" + int.Parse(myDS.Tables[0].Rows[Num]["Jewel_Sub_Type_ID"].ToString());lb_sub.Click += new EventHandler(lb_sub_Click);
- }
- void lb_sub_Click(object sender, EventArgs e)
- {
- string UserName = HttpContext.Current.Session["UN"].ToString();
- LinkButton lb_sub = sender as LinkButton;
- HttpContext.Current.Session["SubType"] = lb_sub;
- string lb_id = lb_sub.ID;
- int sub_id = int.Parse(lb_id.Remove(0, lb_id.IndexOf('_') + 1));
- string connstr = HttpContext.Current.Session["Connstr"].ToString();
- System.Data.OleDb.OleDbConnection myConn = new System.Data.OleDb.OleDbConnection(connstr);
- string all_name = "Select * from TBL_Jewel_Name where Jewel_Sub_Type_ID=" + sub_id + "";
- System.Data.OleDb.OleDbDataAdapter myAdapter_name = new System.Data.OleDb.OleDbDataAdapter(all_name, myConn);
- System.Data.DataSet myDS_name = new System.Data.DataSet();
- myAdapter_name.Fill(myDS_name);
- HttpContext.Current.Session["NameBySubTypeDS"] = myDS_name;HttpContext.Current.Response.Redirect("JewelIntro.aspx?UserName=" +UserName + "&IsUserSigned=true");
- }
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.