using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using Digita.Tustena.Base; using Digita.Tustena.WebControls; using Digita.Tustena.Core; using Digita.Tustena.BusinessObjects; public partial class MyTab : GUserControl, ITabbed { protected void Page_Load(object sender, EventArgs e) { //check if the tab is visible, instead skip tab initialization if (Parent.Parent is TustenaTabber) ((TustenaTabber)Parent.Parent).TabClick += new TabClickDelegate(StatsTab_TabClick); } protected override void OnInit(EventArgs e) { button.Click += new EventHandler(button_Click); base.OnInit(e); } void StatsTab_TabClick(string tabId) { if (tabId == "vis"+this.tabId) { // parameters are exposed through Context. The id is "CE_Id" int id = (int)GetContextElements("Id"); CompanyBO companyBO = new CompanyBO(UC); companyBO.Load(id); myId.Text = id.ToString(); myCompany.Text = companyBO.CompanyName; } } void button_Click(object sender, EventArgs e) { ((G)Page).RegisterJavascriptBlock(GetType(), "test", "alert('" + myCompany.Text + "');", true); } #region ITabbed Interface Declaration public string tabCaption { //Tab Name get { return "MyTab"; } } public TabContainersList tabContainerType { // Target Tabber get { return TabContainersList.CrmCompany; } } public string tabId { // id get { return "warrantyTab"; } } public byte tabPosition { // tab position get { return 2; } } #endregion }
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MyTab.ascx.cs" Inherits="MyTab " %> <asp:LinkButton runat="server" ID="myId"></asp:LinkButton> <asp:LinkButton runat="server" ID="myCompany"></asp:LinkButton> <asp:Button runat="server" ID="button" Text="Test Postback" />
ITabber
tabCaption
tabContainerType
tabId
tabPosition