wiki
Benvenuto Ospite, sei in: Login
RSS RSS

Navigazione (Tech)





Ricerca wiki
»
Creating dynamic tabs, it allows extending cards for company, contacts, prospects for own like, you can integrate them with other applications To create a new "tab", at first you have to add a file .ascx (it's no important its name) in cartel "TabControls"
Questa pagina è solo un Draft, il contenuto può essere incompleto e contenere errori.
In attached an example of codebehind explaining events
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
}

ASP.NET html Example Page

<%@ 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" />

When file.cs is created, yuo have to create an heredity to class from ITabber and implement interface as in example
  • tabCaption - Tag thah will appear on the tab
  • tabContainerType - Cartel to wich tab is going to be added, you must refer to Numb to implement other cards
  • tabId - Id del Tab, deve essere univoco, Id of Tab will be unique
  • tabPosition - Position of tab in the control-

Completing characteristcs, the tab will be completed and loaded in the cartel

There are some other points you must consider. As you can see in the example, in page_load is verified if control is visible: it avoids to initialize if tab is not selected; also precludes access at context that would contain empty issues

The control, infact, matchs his references to Business Objects on wich is loaded the card. Specifically, each page writes in context Id of open BO and it has his access through:(int)GetContextElements("Id");