TabPanel in Tab Container not visible

amolgurude
 
on May 12, 2022 01:09 AM
178 Views

Design Code in ASp.net

<%@ Page Title="" Language="C#" MasterPageFile="~/Master/Master.Master" AutoEventWireup="true" CodeBehind="AD_KnowledgeRepository.aspx.cs" Inherits="FarmERPOnLine.Admin.AD_KnowledgeRepository" %>


<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link rel="stylesheet" href="../../App_Content/css/audit.css" />
    <link rel="stylesheet" href="../App_Content/css/stylesheet.css" />
    <style>
        @media (min-width: 1200px) {
            .container {
                width: 100% !important;
            }
        }

        .descriptiontext {
            white-space: normal;
        }

        .textbold {
            font-family: system-ui;
            font-weight: bold;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:PlaceHolder ID="PC1" runat="server">

    <!------ Include the above in your HEAD tag ---------->

    <style>
        i, span {
            white-space: nowrap;
        }

        .thumb {
            /*border: 1px solid #a9a9a9;*/
            margin-top: 15px;
            margin-bottom: 15px;
            /*margin-left: 75px;*/
        }


        h4 {
            font-size: 19px !important;
            font-weight: 400 !important;
        }

        .modal-title {
            margin-bottom: -19px;
            line-height: 1.5;
        }

        .modal-footer {
            padding: 9px !important;
        }

        h5 {
            margin-top: 5px;
            font-weight: 400;
        }
    </style>

    <style>
        .btn:focus, .btn:active, button:focus, button:active {
            outline: none !important;
            box-shadow: none !important;
        }

        #image-gallery .modal-footer {
            display: block;
        }

        /*        .thumb {
            margin-top: 15px;
            margin-bottom: 15px;
        }*/




        .modal-lg {
            max-width: 940px;
        }

        .table-bordered thead td, .table-bordered thead th {
            border-bottom-width: 0px;
            font-size: 10px;
        }

        .table thead th {
            font-size: 12px;
            vertical-align: bottom;
            border-bottom: 0px solid #dee2e6;
        }

        .table thead td {
            font-size: 11px;
            vertical-align: bottom;
            border-bottom: 0px solid #dee2e6;
        }

        .table-bordered td, .table-bordered th {
            border: 1px solid #dee2e6;
        }

        .table td, .table th {
            padding: .75rem;
            vertical-align: top;
            border-top: 1px solid #dee2e6;
        }

        th {
            text-align: inherit;
        }

        *, ::after, ::before {
            box-sizing: border-box;
        }

        user agent stylesheet th {
            display: table-cell;
            vertical-align: inherit;
            font-weight: bold;
            text-align: -internal-center;
        }

        table {
            border-collapse: collapse;
        }

        user agent stylesheet table {
            border-collapse: separate;
            white-space: normal;
            line-height: normal;
            font-weight: normal;
            font-size: medium;
            font-style: normal;
            color: -internal-quirk-inherit;
            text-align: start;
            border-spacing: 2px;
            font-variant: normal;
        }

        .space {
            margin-bottom: 0.5rem !important;
        }

            .space h3 {
                margin-bottom: 0 !important;
            }

        .arrow-right {
            position: absolute !important;
            top: 50% !important;
            right: -38px !important;
            background-color: white;
        }

        .arrow-left {
            position: absolute !important;
            top: 50% !important;
            left: -38px !important;
            background-color: white;
        }

        .certifid {
            position: absolute !important;
            right: 39px !important;
            top: 28px !important;
            color: #26ab0b !important;
        }

        .certifidRed {
            position: absolute !important;
            right: 39px !important;
            top: 28px !important;
            color: red !important;
        }

        #image-gallery {
            text-align: left !important;
        }

        .pnlFooterView {
            width: 100% !important;
            padding-top: 20px !important;
            font-size: 1rem;
        }

            .pnlFooterView input[type="text"] {
                width: 40px !important;
                height: 40px !important;
                font-size: 1rem;
            }

        .dvPaginationNumber {
            padding: 7px;
            border: 1px solid #ddd;
            margin: -2px;
            font-size: 1rem;
            border-collapse: collapse;
        }

        a[disabled="disabled"].dvPaginationNumber {
            background: #09b1aa;
            color: #fff;
            font-size: 1rem;
        }

        .dvPageSize {
            display: inline-block;
            float: right;
            font-size: 1rem;
            font-family: 'latosemibold' !important;
        }

        .container {
            width: 100% !important;
        }

        .table td, .table th {
            padding: 0px !important;
        }
    </style>


    <div class="row">
        <div class="col-md-6">
            <asp:Label ID="LblServiceCode" runat="server" Text="-" CssClass="heading2">
            </asp:Label>
            <asp:Label ID="lblHeader" runat="server" Text="Knowledge Repository" CssClass="heading2">
            </asp:Label>
        </div>
    </div>

    <div class="clearfix">&nbsp;</div>

    <div class="row">
        <asp:Repeater ID="RptVideodata" runat="server">
            <ItemTemplate>
                <div class="col-lg-3 col-md-3 col-xs-12 thumb">
                    <%-- <div class="box box_act"><a href='<%#Eval("File_Path")%>'><asp:Label ID="lblVideoName" runat="server" Text='<%#Eval("Caption")%>'></asp:Label></a> </div>--%>
                    <div class="thumbnail" style="height: 325px !important; margin-bottom: 5px !important; border: none">
                        <video width="98%" height="98%" controls>
                            <source src="<%#Eval("File_Path")%>" type="video/mp4">
                            <source src="<%#Eval("File_Path")%>" type="video/ogg">
                            Your browser does not support the video tag.
                        </video>

                    </div>

                    <div class="text-left">
                        <table class="table table-bordered success">
                            <thead>
                                <tr>
                                    <td>
                                        <asp:Label ID="lblDate" runat="server" Text='<%#Eval("Date")%>'></asp:Label></td>
                                </tr>

                                <tr>
                                    <td>
                                        <asp:Label ID="lblTags" runat="server" Text='<%#Eval("Tags")%>'></asp:Label></td>
                                </tr>


                                <tr>
                                    <td>
                                        <asp:Label ID="lblTitle" runat="server" CssClass="textbold" Text='<%#Eval("Title")%>'></asp:Label></td>
                                </tr>

                                <tr>
                                    <td>
                                        <asp:Label ID="lblContentDescription" runat="server" CssClass="descriptiontext" Text='<%#Eval("ContentDescription")%>'></asp:Label>
                                        <asp:Label ID="lblContentType" runat="server" Text='<%# Eval("ContentType") %>' Visible="false"> </asp:Label>

                                        <asp:LinkButton ID="lblReadMore"
                                            CommandArgument='<%#Eval("SrNo")%>'
                                            runat="server"
                                            OnClick="lblReadMore_Click"
                                            Text='Read More'>
                                        </asp:LinkButton>

                                    </td>
                                </tr>

                            </thead>
                        </table>
                    </div>

                </div>
            </ItemTemplate>
        </asp:Repeater>
        <table width="100%" border="1" align="left" cellpadding="2" cellspacing="0" class="Repetertable">
            <tr align="center" id="PageFooterView2" runat="server">
                <td colspan="15">
                    <asp:Panel ID="pnlFooterView2" runat="server" DefaultButton="lnkGoToPgNoView2" CssClass="pnlFooterView">
                        <div class="row">
                            <div class="col-md-12 text-center">
                                <asp:Repeater ID="rptPagerView2" runat="server">
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lnkPageView2" runat="server" Text='<%#Eval("Text") %>' CommandArgument='<%# Eval("Value") %>' Enabled='<%# Eval("Enabled") %>' OnClick="lnkPageView_Changed2" CssClass="dvPaginationNumber"></asp:LinkButton>
                                    </ItemTemplate>
                                </asp:Repeater>
                                <asp:TextBox ID="txtGotoPgNoView2" MaxLength="3" onkeyUp="CheckInteger_WithoutZero(this)" runat="server" Height="15px" Width="34px">
                                </asp:TextBox>&nbsp;<asp:LinkButton OnClick="lnkGoToPgNoView_Click2" ID="lnkGoToPgNoView2" runat="server">GoTo</asp:LinkButton>
                                <asp:Label ID="lblFooterStatusView2" runat="server" Text="Label" ForeColor="Blue"></asp:Label>
                                <div class="dvPageSize">
                                    <asp:Label ID="lblRPagesizeView2" runat="server" Text="Page size:" CssClass="new-label"></asp:Label>
                                    <asp:TextBox ID="txtPagesizeView2" runat="server" AutoPostBack="true" OnTextChanged="txtPagesizeView_TextChanged2"
                                        onkeyup="CheckInteger(this)" onblur="WaterMark(this, event);" onfocus="WaterMark(this, event);" Width="40px" MaxLength="2"></asp:TextBox>
                                </div>
                            </div>
                        </div>
                    </asp:Panel>
                </td>
            </tr>
        </table>
    </div>

</asp:PlaceHolder>

</asp:Content>

.Cs code

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using FarmERPBAL.ControlPanel;
using FarmERPBAL.CommonClasses;
using FarmERPDAL.CommonClasses;
using FarmERPOnLine.CommonClasses;
using System.Globalization;
using System.Resources;
using System.Threading;
using System.IO;

namespace FarmERPOnLine.Admin
{
    // public partial class AD_Repository : System.Web.UI.Page
    public partial class AD_KnowledgeRepository : CommonClasses.CustomBasePage
    {

        CommonClasses.CommanClass objCommanClass = new FarmERPOnLine.CommonClasses.CommanClass();
        private AD_ContentManagementBAL objAD_ContentManagementBAL = new AD_ContentManagementBAL();

        int SrNo = 0;
        string PageFlag = "";
        AjaxControlToolkit.TabContainer TabContentCategoryList;

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    if (Request.QueryString["SrNo"] != null)
                    {
                        SrNo = Convert.ToInt32(Request.QueryString["SrNo"]);
                    }

                    //Page Permiession  Start
                    AssignPermession objAssignPermession = new AssignPermession();
                    string FilePath = Path.GetFileName(Request.Url.AbsolutePath);
                    DataRow dr = objAssignPermession.GetCurrentPagePermission(FilePath);

                    if (dr != null)
                    {
                        AssignUserPermission(dr);
                    }
                    else
                    {
                        Response.Redirect("../Admin/HomeMenuPage.aspx");
                    }

                    //DynamicTab();
                    clearpagesize2();
                    FillRepositoryData();
                    SetUICulture();
                }
            }
            catch (Exception ex)
            {

            }

        }


        public void AssignUserPermission(DataRow Dr)
        {
            try
            {
                LblServiceCode.Text = Dr["ServiceCode"].ToString() + Dr["_Line"].ToString();
            }
            catch (Exception ex)
            {
                LogError(ex, "AssignUserPermission", Page.Title);


            }
        }

        private void SetUICulture()
        {
            try
            {
                objCommanClass.funSetCulture(Session["CultureInfo"].ToString());
                ResourceManager rm1 = objCommanClass.funSetResource();

                lblHeader.Text = rm1.GetString("lblRKnowledgeRepository");
                //lblRVideo.Text = rm1.GetString("lblRVideo");
                //if (Request.QueryString["PageFlag"] != null)
                //{
                //    lblHeader.Text = rm1.GetString("lblRObservationGallary");
                //}

            }
            catch (Exception ex)
            {
                objCommanClass.ErrorLogs(ex.GetType().ToString(), Page.Title, "SetUICulture", ex.Message.ToString(), ex.StackTrace, 1, 1, Convert.ToInt32(Session["CompanyId"]), Session["UserName"].ToString(), Convert.ToDateTime(System.DateTime.Now.ToShortDateString()));
                string ErrorLog = "";
                ErrorLog = ex.GetType().ToString() + "\nSTACK STRESS: " + ex.StackTrace;
                UserPageCommonData.LogErrorSendMail(Page.Title, "SetUICulture", ErrorLog, Session["UserName"].ToString(), ex.Message, Session["CompanyName"].ToString());
            }
        }

        public void FillRepositoryData(int PageIndex = 1)
        {
            try
            {

                if (Request.QueryString["SrNo"] != null)
                {
                    SrNo = Convert.ToInt32(Request.QueryString["SrNo"]);
                }

                if (Request.QueryString["PageFlag"] != null)
                {
                    PageFlag = Convert.ToString(Request.QueryString["PageFlag"]);
                }


                int OrganizationId = Convert.ToInt32(Session["CompanyId"].ToString());
                int LanguageId = Convert.ToInt32(Session["LanguageId"].ToString());
                int Login_Id = Convert.ToInt32(Session["LoginId"].ToString());
                int Userid = Convert.ToInt32(Session["UserId"].ToString());


                int PageSize2 = CurrentPgSizeView2();
                string SortOrder2 = ViewState["SortExpression"] + " " + ViewState["SortDirection"];
                txtPagesizeView2.Text = PageSize2.ToString();


                object[] obj = { 0, LanguageId, OrganizationId, Userid, Login_Id, PageIndex, PageSize2, SortOrder2 };
                DataSet Dt = objAD_ContentManagementBAL.KnowledgeRepository(obj);

                DataTable AttVideoData = Dt.Tables[0];
                DataTable VideoCount = Dt.Tables[1];


                if (AttVideoData.Rows.Count > 0)
                {
                    RptVideodata.DataSource = AttVideoData;
                    RptVideodata.DataBind();


                    if (Convert.ToInt32(txtPagesizeView2.Text) > 0)
                    {
                        PageSize2 = Convert.ToInt32(txtPagesizeView2.Text);
                    }


                    int TotalRecordCount2 = Convert.ToInt32(VideoCount.Rows[0]["VideoCount"]);
                    rptPagerView2.DataSource = this.generatePager(TotalRecordCount2, PageSize2, PageIndex);
                    rptPagerView2.DataBind();

                    if (PageIndex < 1)
                        PageIndex = 1;
                    PageIndex = PageIndex - 1;
                    int totRecords2 = (PageIndex * PageSize2) + PageSize2;
                    totRecords2 = totRecords2 > TotalRecordCount2 ? TotalRecordCount2 : totRecords2;
                    PageFooterView2.Visible = true;
                    lblFooterStatusView2.Text = ((PageIndex * PageSize2) + 1).ToString() + " to " + Convert.ToString(totRecords2) + " / " + TotalRecordCount2.ToString();


                }
                else
                {
                    RptVideodata.DataSource = null;
                    RptVideodata.DataBind();
                    PageFooterView2.Visible = false;
                }


            }
            catch (Exception ex)
            {
                objCommanClass.ErrorLogs(ex.GetType().ToString(), Page.Title, "FillRepositoryData", ex.Message.ToString(), ex.StackTrace, 1, 1, Convert.ToInt32(Session["CompanyId"]), Session["UserName"].ToString(), Convert.ToDateTime(System.DateTime.Now.ToShortDateString()));
                string ErrorLog = "";
                ErrorLog = ex.GetType().ToString() + "\nSTACK STRESS: " + ex.StackTrace;
                UserPageCommonData.LogErrorSendMail(Page.Title, "FillRepositoryData", ErrorLog, Session["UserName"].ToString(), ex.Message, Session["CompanyName"].ToString());
            }

        }



        #region Pagination Code Video

        protected void txtPagesizeView_TextChanged2(object sender, EventArgs e)
        {
            try
            {
                //reportname = "ViewDetails";               
                FillRepositoryData();
                txtPagesizeView2.Focus();
            }
            catch (Exception ex)
            {
                LogError(ex, "txtPagesizeView_TextChanged", Page.Title);
            }
        }

        protected void lnkPageView_Changed2(object sender, EventArgs e)
        {
            int pageIndex = int.Parse((sender as LinkButton).CommandArgument);
            ViewState["pageIndexView"] = pageIndex;
            FillRepositoryData(pageIndex);
        }

        private int CurrentPgSizeView2()
        {
            int PageSize = 25;

            if (Session["GridViewPageSize"] != null)
            {
                PageSize = Convert.ToInt32(Session["GridViewPageSize"].ToString());
            }
            int tempPageSize = PageSize;

            if (txtPagesizeView2.Text.Trim() != "" && txtPagesizeView2.Text.Trim() != "0")
            {
                try
                {
                    PageSize = Convert.ToInt32(txtPagesizeView2.Text.Trim());
                    if (PageSize > 100 || PageSize <= 0)
                    {
                        PageSize = tempPageSize;
                    }
                }
                catch (Exception ex)
                {
                    PageSize = tempPageSize;
                    LogError(ex, "CurrentPgSizeView", Page.Title);

                }
            }
            return PageSize;
        }

        protected void lnkGoToPgNoView_Click2(object sender, EventArgs e)
        {
            short GotoPgNo;
            if (short.TryParse(txtGotoPgNoView2.Text, out GotoPgNo))
            {
                string temp = lblFooterStatusView2.Text.Substring(lblFooterStatusView2.Text.IndexOf('/') + 1).Trim();
                if (!string.IsNullOrEmpty(temp))
                {
                    if (GotoPgNo > 0)
                    {
                        short totalPageCount = (short)Math.Ceiling((decimal)Convert.ToInt16(temp) / CurrentPgSizeView2());
                        if (totalPageCount <= GotoPgNo)
                        {
                            GotoPgNo = totalPageCount;
                        }

                        ViewState["pageIndexView"] = GotoPgNo;
                        FillRepositoryData(GotoPgNo);
                    }
                }
                txtGotoPgNoView2.Text = string.Empty;
                lnkGoToPgNoView2.Focus();
            }
        }

        private string GetSortDirection2(string column)
        {

            string sortDirection = "ASC";
            string sortExpression = ViewState["SortExpression"] as string;

            if (sortExpression != null)
            {
                if (sortExpression == column)
                {
                    string lastDirection = ViewState["SortDirection"] as string;
                    if ((lastDirection != null) && (lastDirection == "ASC"))
                    {
                        sortDirection = "DESC";
                    }
                }
            }
            ViewState["SortDirection"] = sortDirection;
            return sortDirection;

        }

        public void clearpagesize2()
        {
            ViewState["pageIndex"] = "1";
            txtPagesizeView2.Text = "25";
            if (Session["GridViewPageSize"] != null)
            {
                txtPagesizeView2.Text = Session["GridViewPageSize"].ToString();
            }
        }


        #endregion

        protected void lblReadMore_Click(object sender, EventArgs e)
        {
            try
            {
                int OrganizationId = Convert.ToInt32(Session["CompanyId"].ToString());
                int LanguageId = Convert.ToInt32(Session["LanguageId"].ToString());
                int Login_Id = Convert.ToInt32(Session["LoginId"].ToString());
                int Userid = Convert.ToInt32(Session["UserId"].ToString());

                int contentype = 0;
                LinkButton lbk = (LinkButton)sender;

                object[] param = { 0, LanguageId, OrganizationId, Userid, Login_Id, lbk.CommandArgument };
                DataTable Dt = objAD_ContentManagementBAL.GetContentTypeForKR(param);

                if (Dt.Rows.Count > 0)
                {
                    contentype = Convert.ToInt32(Dt.Rows[0]["ContentType"].ToString());
                }

                ScriptManager.RegisterClientScriptBlock(Page, GetType(), "aaa", "window.open('../Admin/AD_ContentManagementPostDetails.aspx?SrNo=" + lbk.CommandArgument + "&ContentType=" + contentype + "','Message','toolbar=no,width=900,height=500,left=90,top=90,scrollbars=1,resizable=no')", true);

            }
            catch (Exception ex)
            {
                LogError(ex, "lblReadMore_Click", Page.Title);
            }
        }
        protected void Page_Init(object sender, EventArgs e)
        {
            try
            {
                DynamicTab();
            }
            catch (Exception)
            {

                throw;
            }
        }


        protected void DynamicTab()
        {
            int OrganizationId = Convert.ToInt32(Session["CompanyId"].ToString());
            int LanguageId = Convert.ToInt32(Session["LanguageId"].ToString());
            int Login_Id = Convert.ToInt32(Session["LoginId"].ToString());
            int Userid = Convert.ToInt32(Session["UserId"].ToString());

            int PageIndex = 1;
            int PageSize2 = CurrentPgSizeView2();
            string SortOrder2 = ViewState["SortExpression"] + " " + ViewState["SortDirection"];
            txtPagesizeView2.Text = PageSize2.ToString();

            TabContentCategoryList = new AjaxControlToolkit.TabContainer();
            object[] param = { 0, LanguageId, OrganizationId, Userid, Login_Id, PageIndex, PageSize2, SortOrder2 };
            DataSet Dt = objAD_ContentManagementBAL.KnowledgeRepository(param);
            if (Dt.Tables.Count > 0)
            {
                DataTable dtcontenttype = Dt.Tables[2];
                foreach (DataRow drp in dtcontenttype.Rows)
                {
                    AjaxControlToolkit.TabPanel tblCategorylist = new AjaxControlToolkit.TabPanel();

                    tblCategorylist.HeaderText = drp["Content_Type"].ToString();
                    tblCategorylist.ID = drp["ContentType_ID"].ToString();
                    TabContentCategoryList.Tabs.Add(tblCategorylist);
                }
            }
        }




    }
}

Does not display tab panel  

Download FREE API for Word, Excel and PDF in ASP.Net: Download
arjunv
 
on May 12, 2022 01:09 AM

Not Visible means can you please explain in detail.

amolgurude
 
on May 12, 2022 02:18 AM

tab panel not display

i have already bind value to tabpanel 

dharmendr
 
on May 13, 2022 04:45 AM

Hi amolgurude,

You have defined the AjaxControlToolkit TabContainer TabContentCategoryList.

Then dynamically added the TabPanel to the TabContentCategoryList.

But you didn't added the TabContentCategoryList to the form or page. So it is not displaying.