Iron Speed has the ability to add Infragistics tab controls as a code customization to your web application. The problem with the default implementation is that it uses the URL property to specify the content for the tab. This is ok if you want to display static content within your tabs, but makes it hard to interact with the content within the tabs.
An alternate method to using the URL property of the tabs is to define <ContentTemplate> within the tabs and place user controls within the content templates. The advanelemente of this is that the usercontrols are rendered to the page which means you are able to interact with them.
The aim of this tutorial will be to add an Infragistics tab control to an Iron Speed page and place user controls within those tabs rather than using the Target URL property.
The first thing to understand about the Infragistics tab control is the tab control hierarchy. I spent a bit of time in the documentation and the examples there are really quite poor at explaining how you can add controls to infragistics tabs.
At the top of the hierarchy, is the <igtab:UltraWebTab> element which declares the Tab control on the ASPX page.
Next element is the styling elements which define what each of the tab states will look like. These are:
<DisabledTabStyle />
<DefaultTabStyle />
<HoverTabStyle />
<SelectedTabStyle />
<DefaultTabSeparatorStyle />
I won’t explain too much what these do now, however later on I will define some styles for my tab controls.
The next element in the hierarchy is the <Tabs> element. This element is the key to the Tab control as it is where you define your tabs and tab layouts.
Under the <Tabs> element you have a child element called <igtab:tab> which has another child element called <ContentTemplate> This is where you define your user controls, or any other html you want to appear in the tab.
Let’s take a look at a defining a basic set of tabs within an Tab control.
<igtab: ultrawebtab id=”MyWebTab” runat=”server” SelectedTab=”1″>
<Tabs>
<igtab:tab text=”Employee Details”>
<ContentTemplate>
<h2> Employee Details </h2>
</ContentTemplate>
</igtab:tab>
<igtab:tab text=”Address Details”>
<ContentTemplate>
<h2> Address Details </h2>
</ContentTemplate>
</igtab:tab>
</tabs>
</igtab:ultrawebtab>
This simple code will define a very simple tab control with 2 tabs. As you can see, the tabs are defined under the <Tab> element using the <igtab:tab> element. Within each <igtab:tab> element there is a content template element which has some basic HTML within it.
Now that you have some basic tabs defined, you can place whatever you like into the <ContentTemplate> element including Iron Speed record and table controls. All you need to do is drag a code driven tab control onto the page from the toolbar as shown below
and then modify the html. all you need to do is copy your table control HTML into the <ContentTemplate> of the tab and it will render perfectly in your web browser. Here’s an example from an application I have been working on recently:
<igtab: ultrawebtab id=”MyWebTab” runat=”server” SelectedTab=”1″>
<Tabs>
<igtab:tab text=”Employee Details”>
<ContentTemplate>
<h2>Employer Details</h2>
<div class=”wizardTable”>
<GEN:RECORD NAME=”EmployerRecordControl”>
<!– Begin Record Panel.html –>
REST OF DESIGNER GENERATED CODE GOES HERE
<!—End Record Panel.html–>
</GEN:RECORD>
</div>
</ContentTemplate>
</igtab:tab>
</tabs>
</igtab:ultrawebtab>
Also, it’s really easy to work with these controls all on the same page because Iron Speed doesn’t render them in tabs, but just renders the HTML output. In the image below, I’ve actually got 2 controls defined in two tab controls but only the HTML is rendered so you can work with the controls really easily
The best part is that because your controls are all defined on the same page, the save button has access to all the controls within the tab so when you hit the save button all your controls defined in the tabs will also be saved.
Here’s some screen shots of what the tabs look like within my application:
The first tab in my application
The second tab in application.
So as you can see it’s really easy to use Iron Speed controls and nest them within Infragistics tabs.