Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tabs in a webform 1

Status
Not open for further replies.

ac11nyc

Programmer
Oct 1, 2003
94
US
Does anyone know if you can make an interface in which it looks like you're clicking on tabs to open another page. For instance the Amazon.com site has tabs. Is it possible? If so, where can i find how to do it? thanx
 
There are lots of third party tools that you can get this feature from. You can follow this link and can check out their product.


On second thoughts, I found all the controls a little too expensive. I went ahead and developed my own control. The web site I am using it in is still under development and so I will not be able to send you a link as of now.
 
You can take a look at a set of Microsoft Web Controls at The combintaion of TabStrip/TabSeparator/MultiPage/PageView controls will get you a tabbed panel. It works pretty good, I've been using them in my app without any problems. The disadvantage is that those controls are not supported by MS and pretty limited in functionality.
 
LV,

Since you seem to have experience with the multipage, i wonder if you can tell me how you are handling the page's control's events (ie: button1_onclick event).

It doesnt seem to behave as if the controls were directly on aspx.

If you (or anyone) could provide one breif sample on control event handling on multipages, that would be terrific!

Thanks ahead of time.

PH
I was walking home one night and a guy hammering on a roof called me a paranoid little weirdo.
In morse code.
-Emo Phillips
 
Hey Princess,
Take a look at the following link :


I had to design this page since I could not make te Microsoft controls work and the 3rd party tools were too expensive. If this is that you are looking for, I will be glad to help.

Plz let me know.

Roopam
 
Well the grids are similar, the tabs are similar.

My multipage will be in it's own frame with in a frameset. So my left side menu will also be in it's own frame.

I guess I am mainly concerned about the control events. I see that you have links inside your grids - are these pure links or is there some programmed event to go along with them?

Are you even using tabstrip with Multipage here?

PH
I was walking home one night and a guy hammering on a roof called me a paranoid little weirdo.
In morse code.
-Emo Phillips
 
PH,
I am not using the tabstrip control at all. I spent a lot of time trying to get it to work but well...

The one you see is a customized version of the tab. The links are embedded javascripts in the tab dll.
 
OK I was pursuing your statement above:

The combintaion of TabStrip/TabSeparator/MultiPage/PageView controls will get you a tabbed panel. It works pretty good, I've been using them in my app without any problems.


I do already have a page that uses buttons that look like tabs - so I suppose, if I cannot get any more help on the subject of the multipage, i will go back to that.

Thanks

PH
I was walking home one night and a guy hammering on a roof called me a paranoid little weirdo.
In morse code.
-Emo Phillips
 
Can you describe your situation? What's your setup? What goes wrong with tab strip/multipage once a button is clicked?
 
I could not even get it to work on a page. I was so frustrated that I decided to build my own. Has worked for me and I have made it like a template so I can use it in different projects.
 
Huh... Working just fine in my app for more than a year.
 
Might have been something wrong with Dlls but it is ok. Could not get much help on the boards and that is why I decided to go via unchartered waters.
 
Oops -sorry about that Antzz. As you can see I am thoroughly confused.


In response to LV: this is my problem:


Following is a sample of the code that I had when the buttons were simply on the aspx - and not within a multi-page:


Code:
Private Sub btnEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        If btnEdit.Text = "Edit" Then
            btnEdit.Text = "Cancel"
            btnSave.Enabled = True
            btnRebalance.Enabled = True
        Else
            btnEdit.Text = "Edit"
            btnSave.Enabled = False
            btnRebalance.Enabled = False
        End If
    End Sub

As you can see, I am just trying to manipulate the other buttons on the same multipage but the error states that btnEdit is not declared, btnSave is not declared, btnRebalance is not declared. These are their ID's on the multipage HTML though.


In response to Antzz: Now, I am VERY interested in seeing this template of yours, and some sample code if possible.


Thank you both VERY much! With your help, I think I will actually have a solid plan by today (after 3 weeks of spinning my wheels) !


PH
I was walking home one night and a guy hammering on a roof called me a paranoid little weirdo.
In morse code.
-Emo Phillips
 
ISPrincess: it happens because you're missing declaration for your buttons in the code behind. If you drag a Button control in design view into a PageView, it won't put the declaration in the code behind automaticaly. Here is a sample that I threw together:
Code:
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="ASPNETTests.WebForm1" %>
<%@ Register TagPrefix="iewc" Namespace="Microsoft.Web.UI.WebControls" Assembly="Microsoft.Web.UI.WebControls, Version=1.0.2.226, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>

<HTML>
  <HEAD>
    <title>WebForm1</title>
</HEAD>
  <body>	
    <form id="Form1" method="post" runat="server">
		<iewc:TabStrip id=TabStrip1 runat="server" TargetID="MultiPage1">
			<iewc:Tab Text="Tab 1" />
			<iewc:Tab Text="Tab 2" />
			<iewc:Tab Text="Tab 3" />
        </iewc:TabStrip>
        <iewc:MultiPage id="MultiPage1" runat="server" BorderStyle="Solid" BorderWidth="1px" Width="100%">
			<iewc:PageView id="page0">
				<asp:Button ID="Button1" Runat=server Text="Button 1" />
			</iewc:PageView>
			<iewc:PageView id="page1">
				<asp:Button ID="Button2" Runat=server Text="Button 2" />
			</iewc:PageView>
			<iewc:PageView id="page2">
				<asp:Button ID="Button3" Runat=server Text="Button 3" />
			</iewc:PageView>
        </iewc:MultiPage>    
    </form>	
  </body>
</HTML>

page code behind:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace ASPNETTests
{
	public class WebForm1 : System.Web.UI.Page
	{
		protected Microsoft.Web.UI.WebControls.TabStrip TabStrip1;
		protected Microsoft.Web.UI.WebControls.MultiPage MultiPage1;

        // you are missing the following declarations
		protected System.Web.UI.WebControls.Button Button1;
		protected System.Web.UI.WebControls.Button Button2;
		protected System.Web.UI.WebControls.Button Button3;

	
		private void Page_Load(object sender, System.EventArgs e)
		{
			Button1.Text = "Edit";
			Button2.Text = "Submit";
			Button3.Text = "Cancel";
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			InitializeComponent();
			base.OnInit(e);
		}
		
		private void InitializeComponent()
		{    
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion
	}
}
 
LV!

Thank you Thank you Thank you - You are a life saver.

All the errors have miraculously disappeared, except.... one more question.

One of my buttons Ids is btnEdit. In the code behind I have the sub for btnEdit_Click (defined above in my previous post w/ code). Although, all the buttons referenced do not error, the btnEdit_Click event never fires.

Any ideas?

PH
I was walking home one night and a guy hammering on a roof called me a paranoid little weirdo.
In morse code.
-Emo Phillips
 
In the code behind, check inside of the InitializeComponent; I can bet you a dollar, the event handler for btnEdit_Click is not registered there. Normaly, in the design view, once you double click on a Button, it'll put it there. But not is the button is sitting inside the PageView. It should be something like this (you'll have to convert to VB):
Code:
		private void InitializeComponent()
		{    					
			this.btnEdit.Click += new System.EventHandler(this.btnEdit_Click);
			this.Load += new System.EventHandler(this.Page_Load);
		}
 
I hope that this is not too lame of a question, but in your above inititalizecomponent what is 'this.' refering to?

when i enter:

this.btnEdit.Click = New System.EventHandler(this.btnEdit_Click)
this.Load = New System.EventHandler(this.Page_Load)

Underlines indicate .net error.

PH
I was walking home one night and a guy hammering on a roof called me a paranoid little weirdo.
In morse code.
-Emo Phillips
 
It was C#; if I'm not mistaken, in VB you can do it like this:
Code:
Private Sub btnEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEdit.Click
You don't have to put anything into the InitializeComponent () if you have it with the Handles. I haven't touched VB for a long time, so please test it.
 
how can I dynamically change the text on a TabStrip TAB

say ...
<iewc:TabStrip id=TabStrip1 runat="server" TargetID="MultiPage1">
<iewc:Tab Text="Tab 1" />
<iewc:Tab Text="Tab 2" />
<iewc:Tab Text="Tab 3" />
</iewc:TabStrip>

In my Page Load event.. how can I dynamically code to change the text of "Tab 2" to say "Hello World"

ALso how can I code add or remove new TABS dynamically?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top