I have developed an asp.net 2.0 application for one customer. In it there is a web form with a list of books appearing on an asp.net gridview control. In that gridview, the bookid is a linkbutton, which presently directs you to the book profile page (a simple
page with a bookprofile control in it).
The customer wants to have a number of these book profiles open at the same time, so I have thought about perhaps including my entire web form in a web tab control, and then creating a new tab for each book clicked. When the tab is created, I will load the
book profile control onto it. This way the user will have a "OneNote" kind of experience as more tabs are added, and they can easily navigate through them without having to go back and forth into and out of web forms.
I have been using the Infragistics UltraWebTab. I created a UltraWebTab on a page and then added the first tab with a button to create new tabs, with the code below in the button's click event handler:
When the code executes, when clicking on the buton to add a new tab, a new tab is created and added. When I select the new tab, I can see the close button there. However, when I click the button, I have no click event fired. I need to know how to capture
the event of a newly created control.
Also, when I add more than one tabs, only the last tab contains the close button; the button disappears from all other tabs.
Member
5 Points
66 Posts
Adding Web Tabs programmatically
Apr 23, 2010 02:18 AM|cloucas|LINK
Hello
I have developed an asp.net 2.0 application for one customer. In it there is a web form with a list of books appearing on an asp.net gridview control. In that gridview, the bookid is a linkbutton, which presently directs you to the book profile page (a simple page with a bookprofile control in it).
The customer wants to have a number of these book profiles open at the same time, so I have thought about perhaps including my entire web form in a web tab control, and then creating a new tab for each book clicked. When the tab is created, I will load the book profile control onto it. This way the user will have a "OneNote" kind of experience as more tabs are added, and they can easily navigate through them without having to go back and forth into and out of web forms.
I have been using the Infragistics UltraWebTab. I created a UltraWebTab on a page and then added the first tab with a button to create new tabs, with the code below in the button's click event handler:
Infragistics.WebUI.UltraWebTab.Tab newTab=new Infragistics.WebUI.UltraWebTab.Tab();
Button closeButton = new Button();
closeButton.Text = "Close";
newTab.ContentPane.Controls.Add(closeButton);
UltraWebTab1.Tabs.Add(newTab);
When the code executes, when clicking on the buton to add a new tab, a new tab is created and added. When I select the new tab, I can see the close button there. However, when I click the button, I have no click event fired. I need to know how to capture the event of a newly created control.
Also, when I add more than one tabs, only the last tab contains the close button; the button disappears from all other tabs.
Any help is greatly appreciated.
Regards
Chris
Contributor
2594 Points
578 Posts
Re: Adding Web Tabs programmatically
Apr 23, 2010 06:12 AM|Jalpesh P. Vadgama|LINK
Where is the event handler for the tab?
I think you need to put event handler for tab?
If not then can you please put the whole code with events here.
Cheers,
Microsoft MVP(Visual C#),Computer Geek,Lifelong Learner
My Technology Blog : www.dotnetjalps.com
Mark as answer if my anwers helps you
Member
5 Points
66 Posts
Re: Adding Web Tabs programmatically
May 03, 2010 12:51 AM|cloucas|LINK
Thanks for your reply. Here's my aspx code first:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register assembly="Infragistics2.WebUI.UltraWebTab.v8.1, Version=8.1.20081.1000, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.WebUI.UltraWebTab" tagprefix="igtab" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<igtab:UltraWebTab ID="UltraWebTab1" runat="server">
<Tabs>
<igtab:Tab Text="Main Tab">
<ContentTemplate>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
Text="Create new tab" />
<br />
<br />
<asp:Button ID="Button2" runat="server" Text="Close tab" />
</ContentTemplate>
</igtab:Tab>
</Tabs>
</igtab:UltraWebTab>
<asp:Label ID="tabIdLabel" runat="server" Text="" Visible="false"></asp:Label>
</div>
</form>
</body>
</html>
Then this is the c# code behind:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
public int tabId;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
tabIdLabel.Text = "0";
}
}
protected void Button1_Click(object sender, EventArgs e)
{
Infragistics.WebUI.UltraWebTab.Tab newTab = new Infragistics.WebUI.UltraWebTab.Tab();
newTab.Text="New Tab" + tabIdLabel.Text.ToString();
newTab.Key = newTab.Text;
tabIdLabel.Text = (Convert.ToInt16(tabIdLabel.Text) + 1).ToString();
Button closeButton = new Button();
closeButton.Text = "Close";
//closeButton.ID = "btnClose";
newTab.ContentPane.Controls.Add(closeButton);
UltraWebTab1.Tabs.Add(newTab);
}
}