Using tabstrip in a user control

A

Adwait Ullal

Hello:

Does anyone have a sample of using the Microsoft TabStrip control in a
custom user control (ascx) ?

Please share code and/or URLs.

Thanks in adance

- Adwait
 
A

Adwait Ullal

Leon:

I am familiar with the usage of control however I am looking at using the
TabStrip control in a custom user control (ascx).

When I tried it, I got an error, which I will post tomorrow since I don't
have it available at the moment.

- Adwait
 
A

Adwait Ullal

Here is my TabStripHome.ascx:

<%@ Register TagPrefix="ie" Namespace="Microsoft.Web.UI.WebControls"
Assembly="Microsoft.Web.UI.WebControls" %>
<%@ Register TagPrefix="uctab" TagName="tabStripHome"
Src="Controls/tabStripHome.ascx" %>
<%@ Page language="c#" Codebehind="default.aspx.cs" AutoEventWireup="false"
Inherits="CAMSRediLink._default" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>default</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<uctab:tabStripHome id="tabStripHome" runat="server"></uctab:tabStripHome>
</form>
</body>
</HTML>

Here is the default.aspx:

<%@ Register TagPrefix="ie" Namespace="Microsoft.Web.UI.WebControls"
Assembly="Microsoft.Web.UI.WebControls" %>
<%@ Register TagPrefix="uctab" TagName="tabStripHome"
Src="Controls/tabStripHome.ascx" %>
<%@ Page language="c#" Codebehind="default.aspx.cs" AutoEventWireup="false"
Inherits="CAMSRediLink._default" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>default</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<uctab:tabStripHome id="tabStripHome" runat="server"></uctab:tabStripHome>
</form>
</body>
</HTML>


And here is the error I get:

Parser Error
Description: An error occurred during the parsing of a resource required to
service this request. Please review the following specific parse error
details and modify your source file appropriately.

Parser Error Message: The base class includes the field 'tabStripHome', but
its type (Microsoft.Web.UI.WebControls.TabStrip) is not compatible with the
type of control (ASP.tabStripHome_ascx).

Source Error:


Line 13: <body MS_POSITIONING="GridLayout">
Line 14: <form id="Form1" method="post" runat="server">
Line 15: <uctab:tabStripHome id="tabStripHome"
runat="server"></uctab:tabStripHome>
Line 16: </form>
Line 17: </body>


Source File: c:\inetpub\wwwroot\CAMSRediLink\default.aspx Line: 15
 
A

Adwait Ullal

Leon:

Thanks ... that works.

- Adwait

Leon Friesema said:
Here is my TabStripHome.ascx: [BIG SNIPPET OF CODE #1]

Here is the default.aspx: [BIG SNIPPET OF CODE #2]


And here is the error I get:
[BIG SNIPPET OF STACKTRACE]


Adwait Ullal said:
Leon:

I am familiar with the usage of control however I am looking at using the
TabStrip control in a custom user control (ascx).

When I tried it, I got an error, which I will post tomorrow since I don't
have it available at the moment.

- Adwait

My (example) default.aspx

<%@ Register TagPrefix="uc1" TagName="tabdebug" Src="tabdebug.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
---> etc, etc
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<uc1:tabdebug id="Tabdebug1"
runat="server"></uc1:tabdebug>
</form>
</body>
</html>


tabdebug.ascx:
<%@ Control Language="c#" AutoEventWireup="false"
Codebehind="tabdebug.ascx.cs" Inherits="tabdebug"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<%@ Register TagPrefix="ie" Namespace="Microsoft.Web.UI.WebControls"
Assembly="Microsoft.Web.UI.WebControls" %>
<ie:TabStrip id="TabStrip1" runat="server"
TabSelectedStyle="background-color:silver;color:dimgray;border:1px
solid black;"
TabHoverStyle="background-color:#777777"
TabDefaultStyle="background-color:#0000CC;font-family:verdana;font-weight:bold;font-size:8pt;color:#ffffff;width:85;height:21;text-align:center"
AutoPostBack="True">
<ie:Tab Text="Tab1"></ie:Tab>
<ie:Tab Text="Tab2"></ie:Tab>
<ie:Tab Text="Tab3"></ie:Tab>
</ie:TabStrip>

tabdebug.ascx.cs:
..
..
private void InitializeComponent()
this.TabStrip1.SelectedIndexChange += new
System.EventHandler(this.TabStrip1_SelectedIndexChange);
..
..
private void TabStrip1_SelectedIndexChange(object
sender, System.EventArgs e)
{
//DO something here
}




It seems to me, with the error you're recieving you try to use the
TabStrip as some sort of base class.
Anyway the example above works, so.

gr.Leon.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top