This message was discovered on ASPFriends.com 'aspngwebcontrols' list.
| Bill Bassler |
Firstly, I've played around with the IE webcontrols tabstrip. It's really not that easy to use.
What I'm interested in is if there is an existing custom control (preferably so I can see it at design-time) that has easily configurable client-side roll overs (image swapping), and easy tab style, image configuration.
I'm looking for something that would easily be configurable by a GUI developer (which the IE tab-control really is not)
It might even be data driven and take the form of a horizontally oriented DataList of some kind??
The GUI developers are already complaining that they can't control the "controls" and are unwilling to do much (i.e. no) homework on how the Webform infrastructure puts together these things.
This is a problem as I anticipated.
|
|
| |
| |
| Joao Cardoso |
My solution was easy.... created a class, that renders in a container a table with linkbuttons inside. Then, applying a style, with some background pictures and raising an event, worked for me.
Its quite simple and very effective.
Regards
Joao Cardoso
----- Original Message ----- From: "Bill Bassler" <Click here to reveal e-mail address> Newsgroups: aspngwebcontrols To: "aspngwebcontrols" <Click here to reveal e-mail address> Sent: Tuesday, August 06, 2002 12:44 PM Subject: [aspngwebcontrols] Is there a tab control (not the IE WebControl) that encapsulates a basic "ASP-style" tabstrip
[Original message clipped]
|
|
| |
|
| |
| Joao Cardoso |
As requested here is the source code for my TabControl. Please noteb that this was made a while ago, when I was still learning .NET and for this there may be some bad coding pratices as well as minor bugs.
Some properties are directly assigned, and there is no error handling yet.
If you want to use more than one tab control in the same page, be sure to change the default ID before invoking RenderTab
This source code is provided as IS of course, and improvements are very welcome to be posted back.
Hope this at least helps giving you new ideias for a tabcontrol.
You are free to use this code, as I developed this for academic propuses a while ago.
Best regards
Joao Cardoso
Imports System.Web Imports System.Web.UI Imports System.Web.UI.WebControls
Public Class myTabControl
Private Class TabControl
Public nTabIndex As Integer Public cTabText As String Public lTabEnabled As Boolean Public lTabVisible As Boolean
End Class
Private TabControlCollection As New Collection() Public nCurrentTab As Integer Public lEnabled As Boolean Public lVisible As Boolean Public ID As String = "myTabControl"
Public Event Click(ByVal Index As Integer)
Public Sub AddItem(ByVal nTab As Integer, ByVal Text As String, Optional ByVal Enabled As Boolean = True, Optional ByVal Visible As Boolean = True)
Dim oTab As New TabControl()
oTab.nTabIndex = nTab oTab.cTabText = Text oTab.lTabEnabled = Enabled oTab.lTabVisible = Visible
TabControlCollection.Add(oTab)
End Sub
Private Sub myLinkButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim oLinkMenu As LinkButton = CType(sender, LinkButton)
RaiseEvent Click(CInt(oLinkMenu.Attributes("TAB")))
End Sub
Private Function AddTab(ByVal nTabID As Integer, ByVal cText As String, Optional ByVal Enabled As Boolean = True, Optional ByVal Visible As Boolean = True) As System.Web.UI.WebControls.TableCell Dim rCol As System.Web.UI.WebControls.TableCell Dim oLinkMenu As LinkButton
rCol = New WebControls.TableCell()
oLinkMenu = New LinkButton() If nTabID = nCurrentTab Then rCol.CssClass = "TabSelected" oLinkMenu.Enabled = False oLinkMenu.Visible = True Else oLinkMenu.Enabled = Enabled oLinkMenu.Visible = Visible rCol.CssClass = "TabNormal" End If
oLinkMenu.ID = ID & Format(nTabID, "0000") oLinkMenu.Text = "| " & cText & " |" oLinkMenu.Attributes.Add("TAB", Format(nTabID, "0000")) oLinkMenu.CssClass = "TabText"
AddHandler oLinkMenu.Click, AddressOf Me.myLinkButton_Click
rCol.Controls.Add(oLinkMenu)
Return rCol
End Function
Public Sub RenderTab(ByRef _Container As System.Web.UI.Control) Dim rRow As System.Web.UI.WebControls.TableRow Dim _TableControl As New System.Web.UI.WebControls.Table() Dim _Tab As TabControl
rRow = New WebControls.TableRow()
For Each _Tab In TabControlCollection
rRow.Cells.Add(AddTab(_Tab.nTabIndex, _Tab.cTabText, _Tab.lTabEnabled, _Tab.lTabVisible))
Next
rRow.ControlStyle.Height = New System.Web.UI.WebControls.Unit("20px")
_TableControl.Rows.Add(rRow)
_Container.Controls.Add(_TableControl)
End Sub
End Class
|
|
| |
|
| |
| Michael Wells |
As Joao pointed out, tabstrips are very easy to create from scratch, especially if you can choose your look-and-feel characteristics in advance.=20
However, the IE WebControl tabstrip is actually very easy to use. It may seem a bit overly complex at first glance--but only because MS decided not to constrain the look-and-feel options. The large number of properties can be broken down into groups of functionality, and in most cases you will only need to use a small portion.
If you decide to give it a second look, there are a few observations that may help...
+ About 50% of the methods/properties are designed for client-side, and 50% are designed for server-side. Generally, you will only be using one set, so you can ignore the other half once you decide on the tab-click processing behavior.=20
+ Of that 50%, about half of the properties are used to control graphical look-and-feel, while the other half control text and style-controlled appearances. =20
+ Spacers are optional, and you can ignore them entirely with decent effects. That can cut away another 50% of the properties (leaving you with about 12% to pay attention to)
+ The only event that really matters is Click
If you're looking for simplicity, you just need to decide which handful of properties you want to use.
Assuming your designer will only be changing look-and-feel, the HTML tags are easy enough to edit, and don't require a recompile. You can easily change the CSS tags to specify appearance of the different tab states (a nice feature!).=20
If you decide to go the build-from-scrath route, I recommend using a simple XML + XSL transformation. Define your tabstrip as XML, and transform it using XSL. Your designers should be familiar with both, and this approach gives you 100% separation of content and presentation.
-- Michael Wells
[Original message clipped]
|
|
| |
|
| |
| Bill Bassler |
It'd be nice to see a useable example of configuring the look and feel of the MS tabstrip (images etc). .. and setup/configuration of links
"Michael Wells" <Click here to reveal e-mail address> wrote in message news:694222@aspngwebcontrols...
As Joao pointed out, tabstrips are very easy to create from scratch, especially if you can choose your look-and-feel characteristics in advance.
However, the IE WebControl tabstrip is actually very easy to use. It may seem a bit overly complex at first glance--but only because MS decided not to constrain the look-and-feel options. The large number of properties can be broken down into groups of functionality, and in most cases you will only need to use a small portion.
If you decide to give it a second look, there are a few observations that may help...
+ About 50% of the methods/properties are designed for client-side, and 50% are designed for server-side. Generally, you will only be using one set, so you can ignore the other half once you decide on the tab-click processing behavior.
+ Of that 50%, about half of the properties are used to control graphical look-and-feel, while the other half control text and style-controlled appearances.
+ Spacers are optional, and you can ignore them entirely with decent effects. That can cut away another 50% of the properties (leaving you with about 12% to pay attention to)
+ The only event that really matters is Click
If you're looking for simplicity, you just need to decide which handful of properties you want to use.
Assuming your designer will only be changing look-and-feel, the HTML tags are easy enough to edit, and don't require a recompile. You can easily change the CSS tags to specify appearance of the different tab states (a nice feature!).
If you decide to go the build-from-scrath route, I recommend using a simple XML + XSL transformation. Define your tabstrip as XML, and transform it using XSL. Your designers should be familiar with both, and this approach gives you 100% separation of content and presentation.
-- Michael Wells
[Original message clipped]
|
|
| |
|
| |
| =?iso-8859-1?Q?Jonathan_Hjertstr=F6m?= |
Hi,
Thanks for the code. Maybe a stupid question but how do I create the tab = from my asp.net page. I did some testing but only got the "Object = reference not set to an instance of an object." error message. Do you = have some short sample code?
Thanks a lot!!!
Jonathan Hjertstr=F6m
-----Original Message----- From: Joao Cardoso [mailto:Click here to reveal e-mail address]=20 Sent: den 6 augusti 2002 16:27 To: aspngwebcontrols Subject: [aspngwebcontrols] Re: Is there a tab control (not the IE = WebControl) that encapsulates a basic "ASP-style" tabstrip
As requested here is the source code for my TabControl. Please noteb = that this was made a while ago, when I was still learning .NET and for this = there may be some bad coding pratices as well as minor bugs.
Some properties are directly assigned, and there is no error handling = yet.
If you want to use more than one tab control in the same page, be sure = to change the default ID before invoking RenderTab
This source code is provided as IS of course, and improvements are very welcome to be posted back.
Hope this at least helps giving you new ideias for a tabcontrol.
You are free to use this code, as I developed this for academic propuses = a while ago.
Best regards
Joao Cardoso
Imports System.Web Imports System.Web.UI Imports System.Web.UI.WebControls
Public Class myTabControl
Private Class TabControl
Public nTabIndex As Integer Public cTabText As String Public lTabEnabled As Boolean Public lTabVisible As Boolean
End Class
Private TabControlCollection As New Collection() Public nCurrentTab As Integer Public lEnabled As Boolean Public lVisible As Boolean Public ID As String =3D "myTabControl"
Public Event Click(ByVal Index As Integer)
Public Sub AddItem(ByVal nTab As Integer, ByVal Text As String, Optional ByVal Enabled As Boolean =3D True, Optional ByVal Visible As = Boolean =3D True)
Dim oTab As New TabControl()
oTab.nTabIndex =3D nTab oTab.cTabText =3D Text oTab.lTabEnabled =3D Enabled oTab.lTabVisible =3D Visible
TabControlCollection.Add(oTab)
End Sub
Private Sub myLinkButton_Click(ByVal sender As Object, ByVal e = As System.EventArgs)
Dim oLinkMenu As LinkButton =3D CType(sender, LinkButton)
RaiseEvent Click(CInt(oLinkMenu.Attributes("TAB")))
End Sub
Private Function AddTab(ByVal nTabID As Integer, ByVal cText As String, Optional ByVal Enabled As Boolean =3D True, Optional ByVal = Visible As Boolean =3D True) As System.Web.UI.WebControls.TableCell Dim rCol As System.Web.UI.WebControls.TableCell Dim oLinkMenu As LinkButton
rCol =3D New WebControls.TableCell()
oLinkMenu =3D New LinkButton() If nTabID =3D nCurrentTab Then rCol.CssClass =3D "TabSelected" oLinkMenu.Enabled =3D False oLinkMenu.Visible =3D True Else oLinkMenu.Enabled =3D Enabled oLinkMenu.Visible =3D Visible rCol.CssClass =3D "TabNormal" End If
oLinkMenu.ID =3D ID & Format(nTabID, "0000") oLinkMenu.Text =3D "| " & cText & " |" oLinkMenu.Attributes.Add("TAB", Format(nTabID, "0000")) oLinkMenu.CssClass =3D "TabText"
AddHandler oLinkMenu.Click, AddressOf Me.myLinkButton_Click
rCol.Controls.Add(oLinkMenu)
Return rCol
End Function
Public Sub RenderTab(ByRef _Container As System.Web.UI.Control) Dim rRow As System.Web.UI.WebControls.TableRow Dim _TableControl As New System.Web.UI.WebControls.Table() Dim _Tab As TabControl
rRow =3D New WebControls.TableRow()
For Each _Tab In TabControlCollection
rRow.Cells.Add(AddTab(_Tab.nTabIndex, _Tab.cTabText, _Tab.lTabEnabled, _Tab.lTabVisible))
Next
rRow.ControlStyle.Height =3D New System.Web.UI.WebControls.Unit("20px")
_TableControl.Rows.Add(rRow)
_Container.Controls.Add(_TableControl)
End Sub
End Class
| [aspngwebcontrols] member Click here to reveal e-mail address =3D YOUR ID | http://www.asplists.com/asplists/aspngwebcontrols.asp =3D JOIN/QUIT
|
|
| |
|
| |
| Michael Wells |
http://msdn.microsoft.com/library/default.asp?url=3D/workshop/webcontrols= / overview/tabstrip.asp
Check out the examples in the Formatting and Customization section.
-- Michael Wells
[Original message clipped]
|
|
| |
|
| |
| Joao Cardoso |
Sample:
On the asp or ascx page on declaration: Private WithEvents myTab1 As myTabControl
On Page_Init (to capture the event )
myTab1 = New myTabControl() myTab1 .ID = "myTabAddress" myTab1 .AddItem(0, "Local Address") myTab1 .AddItem(1, "Origin Address") myTab1 .nCurrentTab = nAddressTab myTab1 .RenderTAB(pnlTabContainer) ' A panel to be used as a container
Private Sub myTab1_Click(ByVal Index As Integer) Handles myTab1.Click ' Handle Index contents End Sub
Hope this helps
----- Original Message ----- From: "Jonathan Hjertström" <Click here to reveal e-mail address> To: "aspngwebcontrols" <Click here to reveal e-mail address> Sent: Tuesday, August 06, 2002 6:30 PM Subject: [aspngwebcontrols] Re: Is there a tab control (not the IE WebControl) that encapsulates a basic "ASP-style" tabstrip
Hi,
Thanks for the code. Maybe a stupid question but how do I create the tab >from my asp.net page. I did some testing but only got the "Object reference not set to an instance of an object." error message. Do you have some short sample code?
Thanks a lot!!!
Jonathan Hjertström
|
|
| |
|
| | |
| |
| Bill Bassler |
To better explain what I mean by "not easy" ... I guess I should have said something about getting the tab controls to work with the multipage control. I didn't find it intuitive.
"Bill Bassler" <Click here to reveal e-mail address> wrote in message news:694148@aspngwebcontrols... [Original message clipped]
|
|
| |
|
| |
| Keith Grunow |
I have built a tab control that is completely graphical for our designers. If you would like the code email me direct (the email size in this forum is too small)
Best regards,
Keith Grunow Chief Technical Officer Cyberworks Consulting Bankok, Thailand
-----Original Message----- From: Yannick Smits [mailto:Click here to reveal e-mail address] Sent: Wednesday, August 07, 2002 5:38 AM To: aspngwebcontrols Subject: [aspngwebcontrols] Re: Is there a tab control (not the IE WebControl) that encapsulates a basic "ASP-style" tabstrip
Have a look at this article: http://aspfree.com/authors/lisa_welch/horizontal.aspx
hth, Yannick Smits
"Bill Bassler" <Click here to reveal e-mail address> wrote in message news:694148@aspngwebcontrols... [Original message clipped]
| [aspngwebcontrols] member Click here to reveal e-mail address = YOUR ID | http://www.asplists.com/asplists/aspngwebcontrols.asp = JOIN/QUIT
--- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.380 / Virus Database: 213 - Release Date: 7/24/2002
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.380 / Virus Database: 213 - Release Date: 7/24/2002
|
|
| |
|
| |
| Bill Bassler |
Now this is very cool! Question what's the best way to load controls into the tab. I was thinking of using a Page template to define the layout and loading the controls from user controls something like:
public class ExcusePage : PageTemplate { public void Page_Load(Object sender, EventArgs e) { base.Title = "Warranty Tracker - Main"; base.Header.Controls.Add(new LiteralControl("<h3>ExcuseWare - Always a reason</h3>")); base.Body.Controls.Add(LoadControl("UC_MyUserControl.ascx")); } }
But I don't really know how to load the controls specifically in the tab (i.e. table)??? Maybe if I make the tab a server control and get a reference to it?
Recommendations please
"Yannick Smits" <Click here to reveal e-mail address> wrote in message news:694511@aspngwebcontrols... [Original message clipped]
|
|
| |
|
|
|
|
|