Inheritance: System.Web.UI.WebControls.WebControl
コード例 #1
0
    private void PopulateCountry()
    {
        DataTable dtb = GetCategory(@"Select IDDanhMuc, TenDanhMuc From tbl_DanhMuc");
        DataTable dtb2;
        DataRow   drRow;

        for (int i = 0; i < dtb.Rows.Count; i++)
        {
            AjaxControlToolkit.AccordionPane accp = new AjaxControlToolkit.AccordionPane();
            drRow = dtb.Rows[i];
            Label lblHeader = new Label();
            lblHeader.ID   = "lblHead" + i.ToString();
            lblHeader.Text = "<a href='#'>" + drRow["TenDanhMuc"].ToString() + "</a>";
            dtb2           = GetCategory(@"Select IDLoai, TenLoai From tbl_Loai  
                Where IDDanhMuc=" + drRow["IDDanhMuc"].ToString());
            Label lblContent = new Label();
            lblContent.ID   = "lblContent" + i.ToString();
            lblContent.Text = "";
            accp.ID         = "accp" + i.ToString();
            foreach (DataRow dr in dtb2.Rows)
            {
                lblContent.Text += "<a href='SanPham.aspx?TenLoai=" + dr["TenLoai"] + "'>" + dr["TenLoai"].ToString() + "</a><br>";
            }
            accp.HeaderContainer.Controls.Add(lblHeader);
            accp.ContentContainer.Controls.Add(lblContent);
            Accordion1.Panes.Add(accp);
        }
    }
コード例 #2
0
    private void MenuLeft()
    {
        MenuDoc   mn  = new MenuDoc();
        DataTable dtb = mn.Menu();
        DataTable dtb2;
        DataRow   drRow;

        for (int i = 0; i < dtb.Rows.Count; i++)
        {
            AjaxControlToolkit.AccordionPane accp = new AjaxControlToolkit.AccordionPane();
            drRow = dtb.Rows[i];
            Label lblHeader = new Label();
            lblHeader.ID   = "lblHead" + i.ToString();
            lblHeader.Text = "<a href='#'>" + drRow["CateName"].ToString() + "</a>";
            dtb2           = mn.GetCategory(@"Select CateID, CateName From TB_Category  
                Where MenuLevel=1 And ParentID=" + drRow["CateID"].ToString());
            Label lblContent = new Label();
            lblContent.ID   = "lblContent" + i.ToString();
            lblContent.Text = "";
            accp.ID         = "accp" + i.ToString();
            foreach (DataRow dr in dtb2.Rows)
            {
                lblContent.Text += "<a href='ChuyenMuc.aspx?CateID=" + dr["CateID"] + "'>";
                lblContent.Text += @"<img src='Images/blue_bubble.png' border='0' />";
                lblContent.Text += @"&nbsp;" + @"&nbsp;" + dr["CateName"].ToString() + "</a><br>";
            }
            accp.HeaderContainer.Controls.Add(lblHeader);
            accp.ContentContainer.Controls.Add(lblContent);
            Accordion1.Panes.Add(accp);
        }
    }
コード例 #3
0
        /// <summary>
        /// Create the new control hierarchy of AccordionPanes
        /// (using the DataSource if specificed)
        /// </summary>
        /// <param name="useDataSource">Whether or not we should use the DataSource</param>
        protected virtual void CreateControlHierarchy(bool useDataSource)
        {
            int count = -1;
            IEnumerable dataSource = null;
            List<AccordionPane> itemsArray = new List<AccordionPane>();

            if (!useDataSource)
            {
                object viewCount = ViewState[ItemCountViewStateKey];

                // ViewState must have a non-null value for ItemCount because we check for
                // this in CreateChildControls
                if (viewCount != null)
                {
                    count = (int)viewCount;
                    if (count != -1)
                    {
                        List<object> dummyList = new List<object>(count);
                        for (int i = 0; i < count; i++)
                            dummyList.Add(null);
                        dataSource = dummyList;
                        itemsArray.Capacity = count;
                    }
                }
            }
            else
            {
                dataSource = GetData();
                count = 0;
                ICollection collection = dataSource as ICollection;
                if (collection != null)
                    itemsArray.Capacity = collection.Count;
            }

            if (dataSource != null)
            {
                int index = 0;
                foreach (object dataItem in dataSource)
                {
                    AccordionPane ap = new AccordionPane();
                    Controls.Add(ap);

                    CreateItem(dataItem, index, AccordionItemType.Header, ap.HeaderContainer, HeaderTemplate, useDataSource);
                    CreateItem(dataItem, index, AccordionItemType.Content, ap.ContentContainer, ContentTemplate, useDataSource);

                    itemsArray.Add(ap);

                    count++;
                    index++;
                }
            }

            // If we're binding, save the number of items contained in the repeater for use in round-trips
            if (useDataSource)
                ViewState[ItemCountViewStateKey] = ((dataSource != null) ? count : -1);
        }
コード例 #4
0
 protected int IndexForPane(AjaxControlToolkit.AccordionPane p)
 {
     for (int i = 0; i < AccordionCtrl.Panes.Count; i++)
     {
         if (AccordionCtrl.Panes[i] == p)
         {
             return(i);
         }
     }
     return(-1);
 }
コード例 #5
0
    public void LoadNavigationContainer()
    {
        List <MaterialGroup> itemGroups = new List <MaterialGroup>();

        itemGroups = new FacadeManager().GetMenuItems();

        foreach (MaterialGroup item in itemGroups)
        {
            AjaxControlToolkit.AccordionPane pane = new AjaxControlToolkit.AccordionPane();
            //create unique pane id...
            pane.ID = "Pane_" + item.Code;
            //pane.CssClass = "MenuHeaderDiv";
            // pane Header section ...
            HyperLink headerLink = new HyperLink();
            headerLink.Text     = item.Description;
            headerLink.CssClass = "MenuHeader";
            HtmlGenericControl img = new HtmlGenericControl("img");
            img.Attributes["src"]   = "images/menu_arrow.png";
            img.Attributes["class"] = "imgposition";

            pane.HeaderContainer.CssClass = "MenuHeaderDiv";
            pane.HeaderCssClass           = "MenuHeaderDiv";

            pane.HeaderContainer.Controls.Add(headerLink);
            pane.HeaderContainer.Controls.Add(img);


            //creating list of children...
            if (item.ChildGroupItems.Count > 1)
            {
                // Pane Content section...
                HtmlGenericControl list;
                int i = 0;
                foreach (MaterialGroup mg in item.ChildGroupItems)
                {
                    i++;
                    list = new HtmlGenericControl("li");
                    LinkButton linkBtn = new LinkButton();
                    linkBtn.ID = i + "_" + mg.Code;
                    linkBtn.Attributes["runat"] = "server";
                    linkBtn.Text            = mg.Description;
                    linkBtn.CommandArgument = mg.Code + "," + mg.Description;
                    linkBtn.CommandName     = "GetItemCode";
                    linkBtn.CssClass        = "MenuList";
                    linkBtn.Click          += new EventHandler(linkBtn_Click);

                    list.Controls.Add(linkBtn);
                    pane.ContentCssClass = "MenuList";
                    pane.ContentContainer.Controls.Add(list);
                }
            }
            accordMenu.Panes.Add(pane);
        }
    }
コード例 #6
0
 /// <summary>
 /// Crea el sumbenu para los menus desplegables
 /// </summary>
 /// <param name="paneId"></param>
 /// <param name="paneText"></param>
 /// <returns></returns>
 protected AccordionPane Create_Menu(string paneId, string paneText) {
     AccordionPane pane = new AccordionPane();
     pane.ID = paneId;
     Label headerLabel = new Label();
     headerLabel.Text = paneText;
     pane.HeaderContainer.Controls.Add(headerLabel);
     return pane;
 }
コード例 #7
0
    private void InitPrefs()
    {
        // features
        InitFeaturePrefs();

        // Property blacklist
        UpdateBlacklist();

        // Social networking.
        InitSocialNetworking();

        // Set up status of cloud providers and ability to pick a default.
        InitCloudProviders();

        HandleOAuthRedirect();

        acpoAuthApps.Visible = oAuthAuthorizationManager.Refresh();

        string szPane = Request["pane"];

        if (!String.IsNullOrEmpty(szPane))
        {
            acpLocalPrefs.Visible = String.IsNullOrEmpty(Request["nolocalprefs"]);
            int paneIndexOffset = acpLocalPrefs.Visible ? 0 : -1;

            AjaxControlToolkit.AccordionPane acpTarget = null;
            switch (szPane)
            {
            case "backup":
                acpTarget = acpBackup;
                break;

            case "social":
                acpTarget = acpSocialNetworking;
                break;

            case "deadlines":
                acpTarget = acpCustomDeadlines;
                break;

            case "custcurrency":
                acpTarget = acpCustomCurrencies;
                break;

            case "cloudahoy":
                acpTarget = acpCloudAhoy;
                break;

            default:
                break;
            }

            acpCloudAhoy.Visible = (acpTarget == acpCloudAhoy);

            for (int i = 0; i < accordianPrefs.Panes.Count; i++)
            {
                if (accordianPrefs.Panes[i] == acpTarget)
                {
                    accordianPrefs.SelectedIndex = i + paneIndexOffset;
                    break;
                }
            }
        }

        InitDeadlinesAndCurrencies();
    }
コード例 #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string XMLFileName;
        string AppId    = "";
        string Style    = "";
        string Password = "";

        bool LNumValid = true;

        Response.Flush();
        AppId = "ISS";

        Style         = "AccMnt";
        oMDBF.Loginid = Session["mgUSERID"].ToString();

        XMLFileName = Request.ServerVariables["APPL_PHYSICAL_PATH"] + "XML\\" + "Menu_" + AppId + "_" + oMDBF.Loginid + ".xml";

        if (!File.Exists(XMLFileName))
        {
            oMDBF.WriteXMLNew(AppId, oMDBF.Loginid, XMLFileName);
        }
        else
        {
            File.Delete(XMLFileName);
            oMDBF.WriteXMLNew(AppId, oMDBF.Loginid, XMLFileName);
        }

        //MySource.DataFile = XMLFileName;

        DataSet dsMenu = new DataSet();

        dsMenu.ReadXml(XMLFileName);
        DataTable dtMenu = new DataTable();

        dtMenu = dsMenu.Tables[0].Copy();
        if (dtMenu.Rows.Count > 0)
        {
            AccordionPane pn;

            for (int i = 0; i < dtMenu.Rows.Count; i++)
            {
                if (dtMenu.Rows[i]["MsMenuItem_Id_0"].ToString() == "0")
                {
                    Label         lbTitle     = new Label();
                    Label         lbContent   = new Label();
                    StringBuilder sb          = new StringBuilder();
                    DataRow[]     parentMenus = dtMenu.Select("MsMenuItem_Id_0 = " + dtMenu.Rows[i]["MsMenuItem_Id"].ToString());
                    String        UnOrderLsit = GenerateUL(parentMenus, dtMenu, sb);
                    lbTitle.Text = dtMenu.Rows[i]["title"].ToString();
                    //TreeView TrV = GenerateTree(parentMenus, dtMenu, lbTitle.Text, i);
                    //TrV.ID = "TreeView" + i;

                    lbContent.Text = UnOrderLsit;
                    pn             = new AjaxControlToolkit.AccordionPane();
                    pn.ID          = "Pane" + i;
                    pn.HeaderContainer.Controls.Add(lbTitle);
                    pn.ContentContainer.Controls.Add(lbContent);
                    acrDynamic.Panes.Add(pn);
                }
            }
        }

        // Code next..not used
        //if (LNumValid)
        //{
        //    if (!File.Exists(XMLFileName))
        //    {
        //        oMDBF.WriteXMLNew(AppId, oMDBF.Loginid, XMLFileName);
        //    }
        //    else
        //    {
        //        File.Delete(XMLFileName);
        //        oMDBF.WriteXMLNew(AppId, oMDBF.Loginid, XMLFileName);
        //    }
        //    MySource.DataFile = XMLFileName;
        //    TreeNodeBinding tNode = new TreeNodeBinding();
        //    tNode.DataMember = "MsMenuItem";
        //    tNode.TextField = "title";
        //    tNode.TargetField = "result";
        //    tNode.NavigateUrlField = "url";
        //    tNode.ValueField = "menuid";
        //    //tNode.ImageUrlField = "imageUrl";
        //    TreeView2.DataBindings.Add(tNode);
        //}
        //else
        //{
        //    MySource.DataFile = XMLFileName;
        //    TreeNodeBinding tNode = new TreeNodeBinding();
        //    tNode.DataMember = "MsMenuItem";
        //    tNode.TextField = "title";
        //    tNode.TargetField = "result";
        //    tNode.NavigateUrlField = "url";
        //    tNode.ValueField = "menuid";

        //    //tNode.ImageUrlField = "imageUrl";
        //    TreeView2.DataBindings.Add(tNode);
        //}
        Password = "";

        //GetAccordionMenu();
    }
コード例 #9
0
ファイル: wucMenu.ascx.cs プロジェクト: GCSoft/CEDHNL
        // Rutinas de la página
        private void createUserMenu()
        {
            ENTSession oENTSession = new ENTSession();
            DataSet dsMenu;
            String sIDMenu = "";

            AccordionPane oAccordionPane;
            Label lblAccordionHeader;
            HtmlAnchor anchContent;
            Panel pnlContent;
            HiddenField hddContentPageName;

            try
            {

                // Obtener sesion
                oENTSession = (ENTSession)this.Session["oENTSession"];

                // Secciones de Menú
                foreach (DataRow drMenu in oENTSession.tblMenu.Rows){

                    // Obtener el id menu actual
                    sIDMenu = drMenu["idMenu"].ToString();

                    // Nuevo Panel
                    oAccordionPane = new AccordionPane();
                    oAccordionPane.ID = "apnl" + sIDMenu;

                    // Header
                    lblAccordionHeader = new Label();
                    lblAccordionHeader.Text = drMenu["sNombremenu"].ToString();
                    oAccordionPane.HeaderContainer.Controls.Add(lblAccordionHeader);

                    // Content
                    foreach (DataRow drSubMenu in oENTSession.tblSubMenu.Select("idMenu = " + sIDMenu)){

                        // Nuevo panel
                        pnlContent = new Panel();
                        pnlContent.ID = "pnl" + drSubMenu["idSubMenu"].ToString();
                        pnlContent.CssClass = "MenuItem";

                        // Nuevo Anchor
                        anchContent = new HtmlAnchor();
                        anchContent.Title = drSubMenu["sDescripcion"].ToString();
                        anchContent.HRef = this.ResolveUrl(drSubMenu["sURL"].ToString());
                        anchContent.InnerHtml = (char)187 + " " + drSubMenu["sNombreSubMenu"].ToString();

                        // Nuevo campo oculto (nombre de página)
                        hddContentPageName = new HiddenField();
                        hddContentPageName.ID = "hdd" + drSubMenu["idSubMenu"].ToString();
                        hddContentPageName.Value = drSubMenu["sPageName"].ToString();

                        // Agregar contenido al Panel
                        pnlContent.Controls.Add(anchContent);
                        pnlContent.Controls.Add(hddContentPageName);

                        // Agregar contenido al Acordeón
                        oAccordionPane.ContentContainer.Controls.Add(pnlContent);
                    }

                    // Agregar Pane al Acordeón
                    this.acrdMenu.Panes.Add(oAccordionPane);
                }

                // DataSet en ViewState
                dsMenu = new DataSet();
                dsMenu.Tables.Add(oENTSession.tblMenu.Copy());
                dsMenu.Tables.Add(oENTSession.tblSubMenu.Copy());
                this.ViewState["dsMenu"] = dsMenu;

            }catch (Exception ex){
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Convert.ToString(Guid.NewGuid()), "alert('" + gcJavascript.ClearText(ex.Message) + "');", true);
            }
        }
コード例 #10
0
    /// <summary>
    /// To bind Dynamic Menu in Accordion
    /// </summary>
    private void accbind()
    {
        DataTable DtBindMenu = BinMenu();
        DataTable DtMenu     = new DataTable();
        DataTable dtMenu1    = new DataTable();

        if (DtBindMenu != null)
        {
            DtMenu = DtBindMenu.DefaultView.ToTable(true, "MenuId", "Menu", "IsActive");
            DataView DvMenu = new DataView(DtMenu);
            DvMenu.Sort = ("MenuId" + " ASC");
            DtMenu      = DvMenu.ToTable();
            if (DtMenu.Rows.Count != 0)
            {
                int j = 0;
                AjaxControlToolkit.AccordionPane AccPan;
                int   i = 0;   // This is just to use for assigning pane an id
                Label lblMenu;
                //To get Menu Details
                foreach (DataRow Dr in DtMenu.Rows)
                {
                    lblMenu      = new Label();
                    lblMenu.Text = Dr["Menu"].ToString();
                    int       MenuId     = Convert.ToInt16(Dr["MenuID"].ToString());
                    DataTable DtSubMenu  = new DataTable();
                    DataView  DvBindMenu = DtBindMenu.DefaultView;
                    DvBindMenu.RowFilter = "MenuID = " + MenuId;
                    DtSubMenu            = DvBindMenu.ToTable(true, "SubMenuId", "Menu", "IsActive", "Sub Menu", "SubMenuDescription", "SubMenuURL", "MenuID", "SBSRT");
                    AccPan    = new AjaxControlToolkit.AccordionPane();
                    AccPan.ID = "Pane" + j;
                    AccPan.HeaderContainer.Controls.Add(lblMenu);
                    DataView DvMenuBind = new DataView(DtSubMenu);
                    DvMenuBind.Sort = ("SBSRT" + " ASC");
                    DtSubMenu       = DvMenuBind.ToTable();
                    //To get SubMenu Details of Specific Menu
                    if (DtSubMenu.Rows.Count > 0)
                    {
                        DataColumn DcSrNo = new DataColumn("Sr. No");
                        DtSubMenu.Columns.Add(DcSrNo);
                        for (int s = 0; s < DtSubMenu.Rows.Count; s++)
                        {
                            DtSubMenu.Rows[s][8] = j + 1;
                        }
                        foreach (DataRow DrSubMenu in DtSubMenu.Rows)
                        {
                            Label NewLine = new Label();
                            NewLine.Text = "<br/>";
                            LinkButton lnkSubMenu = new LinkButton();
                            lnkSubMenu.ID              = "lnkSubMenu" + i;
                            lnkSubMenu.Text            = DrSubMenu["Sub Menu"].ToString();
                            lnkSubMenu.ToolTip         = DrSubMenu["SubMenuDescription"].ToString();
                            lnkSubMenu.CommandArgument = DrSubMenu["Sr. No"].ToString();
                            lnkSubMenu.CssClass        = DrSubMenu["SubMenuURL"].ToString();
                            lnkSubMenu.EnableTheming   = false;
                            lnkSubMenu.Click          += new System.EventHandler(lnkSubMenu_Click);
                            AccPan.ContentContainer.Controls.Add(new LiteralControl("<li>"));
                            AccPan.ContentContainer.Controls.Add(lnkSubMenu);
                            i++;
                        }
                    }
                    acdnMaster.Panes.Add(AccPan);
                    ++j;
                }
            }
        }
        else
        {
        }
    }
コード例 #11
0
ファイル: Accordion.ascx.cs プロジェクト: KuduApps/Kentico
    /// <summary>
    /// Prepares the layout of the web part.
    /// </summary>
    protected override void PrepareLayout()
    {
        StartLayout();

        Append("<div");

        // Width
        string width = this.Width;
        if (!string.IsNullOrEmpty(width))
        {
            Append(" style=\"width: ", width, "\"");
        }

        if (IsDesign)
        {
            Append(" id=\"", ShortClientID, "_env\">");

            Append("<table class=\"LayoutTable\" cellspacing=\"0\" style=\"width: 100%;\">");

            if (this.ViewMode == ViewModeEnum.Design)
            {
                Append("<tr><td class=\"LayoutHeader\" colspan=\"2\">");

                // Add header container
                AddHeaderContainer();

                Append("</td></tr>");
            }

            Append("<tr><td id=\"", ShortClientID, "_info\" style=\"width: 100%;\">");
        }
        else
        {
            Append(">");
        }

        // Add the tabs
        Accordion acc = new Accordion();
        acc.ID = "acc";
        AddControl(acc);

        if (IsDesign)
        {
            Append("</td>");

            if (AllowDesignMode)
            {
                // Width resizer
                Append("<td class=\"HorizontalResizer\" onmousedown=\"" + GetHorizontalResizerScript("env", "Width", false, "info") + " return false;\">&nbsp;</td>");
            }

            Append("</tr>");
        }

        // Pane headers
        string[] headers = PaneHeaders.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);

        for (int i = 1; i <= Panes; i++)
        {
            // Create new pane
            AccordionPane pane = new AccordionPane();
            pane.ID = "pane" + i;

            // Prepare the header
            string header = null;
            if (headers.Length >= i)
            {
                header = ResHelper.LocalizeString(headers[i - 1]);
            }
            if (String.IsNullOrEmpty(header))
            {
                header = "Pane " + i;
            }

            pane.Header = new TextTransformationTemplate(header);
            acc.Panes.Add(pane);

            AddZone(this.ID + "_" + i, header, pane.ContentContainer);
        }

        // Setup the accordion
        if ((this.ActivePaneIndex >= 1) && (this.ActivePaneIndex <= acc.Panes.Count))
        {
            acc.SelectedIndex = this.ActivePaneIndex - 1;
        }

        acc.ContentCssClass = this.ContentCSSClass;
        acc.HeaderCssClass = this.HeaderCSSClass;
        acc.HeaderSelectedCssClass = this.SelectedHeaderCSSClass;

        acc.FadeTransitions = this.FadeTransitions;
        acc.TransitionDuration = this.TransitionDuration;
        acc.RequireOpenedPane = this.RequireOpenedPane;

        // If no active pane is selected and doesn't require opened one, do not preselect any
        if (!acc.RequireOpenedPane && (this.ActivePaneIndex < 0))
        {
            acc.SelectedIndex = -1;
        }

        if (IsDesign)
        {
            if (AllowDesignMode)
            {
                Append("<tr><td class=\"LayoutFooter\" colspan=\"2\"><div class=\"LayoutFooterContent\">");

                // Pane actions
                Append("<div class=\"LayoutLeftActions\">");

                if (this.Panes > 1)
                {
                    AppendRemoveAction(ResHelper.GetString("Layout.RemoveLastPane"), "Panes");
                    Append(" ");
                }
                AppendAddAction(ResHelper.GetString("Layout.AddPane"), "Panes");

                Append("</div></div></td></tr>");
            }

            Append("</table>");
        }

        Append("</div>");

        FinishLayout();
    }
コード例 #12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        TList <RegionLookup> regions         = new TList <RegionLookup>();
        TList <CustomerSite> customersites   = new TList <CustomerSite>();
        CountryLookup        countrylookup   = new CountryLookup();
        StateProvince        sp              = new StateProvince();
        Teacher             hi               = new Teacher();
        TList <TeacherSite> facilityteachers = new TList <TeacherSite>();

        string[] roles = Roles.GetAllRoles();
        int      i     = 0;

        regions = DataRepository.RegionLookupProvider.GetByUs(1);
        foreach (RegionLookup r in regions)
        {
            i++;
            System.Web.UI.WebControls.Label lblHeader  = new System.Web.UI.WebControls.Label();
            System.Web.UI.WebControls.Label lblContent = new System.Web.UI.WebControls.Label();

            lblHeader.Text = r.RegionName;
            customersites  = DataRepository.CustomerSiteProvider.GetByRegion(r.RegionId);
            customersites.Sort("SiteName");
            lblContent.Text = "";
            #region [commented]

            /*foreach (CustomerSite cs in customersites)
             * {
             *  lblContent.Text = lblContent.Text + "<b>" + cs.SiteName + "</b><br>"
             + cs.Address1 + "<br>";
             +  try
             +  {
             +      if (!cs.Address2.Equals("") && !cs.Address2.Equals(null))
             +          lblContent.Text = lblContent.Text + cs.Address2 + "<br>";
             +  }
             +  catch (Exception ex)
             +  {
             +  }
             +  sp = DataRepository.StateProvinceProvider.GetByStateProvinceId(Convert.ToInt16(cs.StateProvince));
             +  lblContent.Text = lblContent.Text + cs.City + " " + sp.StateProvinceAbbvr + " " + cs.ZipCode + "<br>";
             +
             +  lblContent.Text = lblContent.Text + "<br>";
             + }*/
            #endregion [commented]
            foreach (CustomerSite cs in customersites)
            {
                if (cs.CustomerSiteId != 15)
                {
                    if (cs.IsApproved.Equals(1) && !cs.CustomerSiteId.Equals(9))
                    {
                        facilityteachers = DataRepository.TeacherSiteProvider.GetBySiteId(cs.CustomerSiteId);
                        foreach (TeacherSite ts in facilityteachers)
                        {
                            try
                            {
                                string userrolename = string.Empty;
                                hi = DataRepository.TeacherProvider.GetByTeacherId(ts.TeacherId);
                                //  hi = DataRepository.TeacherProvider.GetByTeacherId(cs.FacilityAdministratorId);
                                Guid           MemGuid  = new Guid(hi.AspnetMembershipUserId.ToString());
                                MembershipUser user     = Membership.GetUser(MemGuid);
                                string[]       userrole = Roles.GetRolesForUser(user.UserName);
                                userrolename = userrole[0];
                                if (userrolename != "Athletes")
                                {
                                    if (userrolename == "Teachers")
                                    {
                                        userrolename = "Coach";
                                    }
                                    lblContent.Text = lblContent.Text + "<table><tr><td colspan=5>"
                                                      + "<b>" + cs.SiteName + "</b></td>"
                                                      + "<tr><td width=300 valign=top>"
                                                      + cs.Address1 + "<br>";
                                    //
                                    try
                                    {
                                        if (!cs.Address2.Equals("") && !cs.Address2.Equals(null))
                                        {
                                            lblContent.Text = lblContent.Text + cs.Address2 + "<br>";
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                    }
                                    if ((cs.StateProvince != string.Empty) || (cs.StateProvince != null))
                                    {
                                        sp = DataRepository.StateProvinceProvider.GetByStateProvinceId(Convert.ToInt16(cs.StateProvince));
                                    }
                                    else
                                    {
                                        cs.StateProvince = "";
                                    }
                                    // sp = DataRepository.StateProvinceProvider.GetByStateProvinceId(Convert.ToInt16(cs.StateProvince));
                                    if (cs.StateProvince.Equals("-1"))
                                    {
                                        lblContent.Text = lblContent.Text + cs.City + " " + cs.ZipCode
                                                          + "</td>";
                                    }
                                    else
                                    {
                                        lblContent.Text = lblContent.Text + cs.City + " " + sp.StateProvinceAbbvr + " " + cs.ZipCode
                                                          + "</td>";
                                    }
                                    lblContent.Text = lblContent.Text + "<td width=180 align=right valign=top><font color=black>" + userrolename + ":<br>Website:</font></td>";

                                    lblContent.Text = lblContent.Text +
                                                      "<td width=180 valign=top> <a href=../Contact/CoachProfile.aspx?teacherid=" + hi.TeacherId.ToString() + ">" + hi.FirstName + " " + hi.LastName + "</a>";

                                    if (cs.Website.Equals("-1"))
                                    {
                                        lblContent.Text = lblContent.Text + "<br>None</td>";
                                    }
                                    else
                                    {
                                        lblContent.Text = lblContent.Text + "<br><a href=http://" + cs.Website + " target=_blank>click here</a></td>";
                                    }
                                    lblContent.Text = lblContent.Text +
                                                      //"<td width=180 align=right valign=top><font color=black>Schedule Lesson:"
                                                      "<td width=180 align=right valign=top><font color=black> <br>Email Coach:</font></td>";

                                    lblContent.Text = lblContent.Text +
                                                      //<a href=../Contact/ScheduleLesson.aspx?facilityid=" + cs.CustomerSiteId.ToString() + ">click here</a>"
                                                      "<td width=100><a href=../Contact/EmailTeacher.aspx?facilityid=" + cs.CustomerSiteId.ToString() + ">click here</a></td></tr>";

                                    lblContent.Text = lblContent.Text + "</table>";
                                }
                            }
                            catch (Exception ex)
                            { }
                        }
                    }
                }
            }

            AjaxControlToolkit.AccordionPane ap2 = new AjaxControlToolkit.AccordionPane();
            ap2.ID = "dynPane" + i.ToString();
            if (lblHeader.Text != "Alaska & Hawaii")
            {
                ap2.HeaderContainer.Controls.Add(lblHeader);
                ap2.ContentContainer.Controls.Add(lblContent);
                Accordion2.Panes.Add(ap2);
            }
        }

        i       = 0;
        regions = DataRepository.RegionLookupProvider.GetByUs(0);

        foreach (RegionLookup r in regions)
        {
            i++;
            System.Web.UI.WebControls.Label lblHeader2  = new System.Web.UI.WebControls.Label();
            System.Web.UI.WebControls.Label lblContent2 = new System.Web.UI.WebControls.Label();
            lblHeader2.Text = r.RegionName;
            customersites   = DataRepository.CustomerSiteProvider.GetByRegion(r.RegionId);
            customersites.Sort("SiteName");
            lblContent2.Text = "";
            foreach (CustomerSite cs in customersites)
            {
                facilityteachers = DataRepository.TeacherSiteProvider.GetBySiteId(cs.CustomerSiteId);
                foreach (TeacherSite ts in facilityteachers)
                {
                    try
                    {
                        string userrolename = string.Empty;
                        hi = DataRepository.TeacherProvider.GetByTeacherId(ts.TeacherId);
                        Guid           MemGuid  = new Guid(hi.AspnetMembershipUserId.ToString());
                        MembershipUser user     = Membership.GetUser(MemGuid);
                        string[]       userrole = Roles.GetRolesForUser(user.UserName);
                        userrolename = userrole[0];
                        if (userrolename != "Athletes")
                        {
                            if (userrolename == "Teachers")
                            {
                                userrolename = "Coach";
                            }
                            if (cs.IsApproved.Equals(1) && !cs.CustomerSiteId.Equals(9))
                            {
                                lblContent2.Text = lblContent2.Text + "<table><tr><td colspan=5>"
                                                   + "<b>" + cs.SiteName + "</b></td>"
                                                   + "<tr><td width=300 valign=top>"
                                                   + cs.Address1 + "<br>";

                                //;
                                try
                                {
                                    if (!cs.Address2.Equals("") && !cs.Address2.Equals(null))
                                    {
                                        lblContent2.Text = lblContent2.Text + cs.Address2;
                                    }
                                    //+"<br>";
                                }
                                catch (Exception ex)
                                {
                                }
                                //sp = DataRepository.StateProvinceProvider.GetByStateProvinceId(Convert.ToInt16(cs.StateProvince));
                                if ((cs.StateProvince.Equals(string.Empty) || cs.StateProvince.Equals(null)))
                                {
                                    countrylookup = DataRepository.CountryLookupProvider.GetByCountryId(cs.Country);
                                }
                                else
                                {
                                    if (cs.Country == 41)
                                    {
                                        sp = DataRepository.StateProvinceProvider.GetByStateProvinceId(int.Parse(cs.StateProvince));
                                    }
                                }

                                if ((cs.StateProvince.Equals("-1")) || (cs.StateProvince.Equals(string.Empty)) || (cs.StateProvince.Equals(null)))
                                {
                                    lblContent2.Text = lblContent2.Text + cs.City + " " + countrylookup.CountryName + " " + cs.ZipCode
                                                       + "</td>";
                                }
                                else
                                {
                                    lblContent2.Text = lblContent2.Text + cs.City + " " + sp.StateProvinceName + " " + cs.ZipCode
                                                       + "</td>";
                                }
                                lblContent2.Text = lblContent2.Text + "<td width=180 align=right valign=top><font color=black>" + userrolename + ":<br>Website:</font></td>";
                                lblContent2.Text = lblContent2.Text +
                                                   "<td width=180 valign=top> <a href=../Contact/CoachProfile.aspx?teacherid=" + hi.TeacherId.ToString() + ">" + hi.FirstName + " " + hi.LastName + "</a>";
                                if (cs.Website.Equals("-1"))
                                {
                                    lblContent2.Text = lblContent2.Text + "<br>None</td>";
                                }
                                else
                                {
                                    lblContent2.Text = lblContent2.Text + "<br><a href=http://" + cs.Website + " target=_blank>click here</a></td>";
                                }
                                lblContent2.Text = lblContent2.Text + "<td width=180 align=right valign=top><br>Email Coach:</font></td>";
                                //<font color=black>Schedule Lesson:"+

                                lblContent2.Text = lblContent2.Text +
                                                   // //<a href=mailto:[email protected]?subject=Support%20Inquiry + cs.CustomerSiteId.ToString() + >click here</a>"
                                                   //"<td width=100><br><a href=mailto:[email protected]?subject=Support%20Inquiry + cs.CustomerSiteId.ToString() + >click here</a></td></tr>";
                                                   "<td width=100><a href=../Contact/EmailTeacher.aspx?facilityid=" + cs.CustomerSiteId.ToString() + ">click here</a></td></tr>";

                                lblContent2.Text = lblContent2.Text + "</table>";
                            }
                        }
                    }
                    catch (Exception ex)
                    { }
                }
            }

            AjaxControlToolkit.AccordionPane ap3 = new AjaxControlToolkit.AccordionPane();
            ap3.ID = "dynPane" + i.ToString();
            if (lblHeader2.Text != "India" && lblHeader2.Text != "Antarctica" && lblHeader2.Text != "Russia" && lblHeader2.Text != "Greenland" && lblHeader2.Text != "Caribbean" && lblHeader2.Text != "Central & South America")
            {
                ap3.HeaderContainer.Controls.Add(lblHeader2);
                ap3.ContentContainer.Controls.Add(lblContent2);
                Accordion4.Panes.Add(ap3);
            }
        }
    }
コード例 #13
0
ファイル: AjaxCollapseMenu.cs プロジェクト: san90279/UK_OAS
        protected override void CreateChildControls()
        {
            Controls.Clear();

            List<AjaxMenuRootItem> rootItems = this.GenItems();
            if (rootItems == null)
            {
                throw new Exception("root item is not exist, please check the 'MenuIDStartValue' property!");
            }

            _accordion = new Accordion();
            _accordion.Width = this.Width;
            _accordion.Height = this.Height;
            _accordion.ID = "InnerAccordion";
            if (this.UserProvideStyle)
            {
                _accordion.HeaderCssClass = "ajaxcm_user_header_unselected";
            #if VS90
                _accordion.HeaderSelectedCssClass = "ajaxcm_user_header_selected";
            #endif
                _accordion.ContentCssClass = "ajaxcm_user_content";
            }
            else
            {
                switch (this.ColorStyle)
                {
                    case AjaxColorStyle.Blue:
                        _accordion.HeaderCssClass = "ajaxcm_header_unselected1";
            #if VS90
                        _accordion.HeaderSelectedCssClass = "ajaxcm_header_selected1";
            #endif
                        _accordion.ContentCssClass = "ajaxcm_content1";
                        break;
                    case AjaxColorStyle.Green:
                        _accordion.HeaderCssClass = "ajaxcm_header_unselected1";
            #if VS90
                        _accordion.HeaderSelectedCssClass = "ajaxcm_header_selected1";
            #endif
                        _accordion.ContentCssClass = "ajaxcm_content2";
                        break;
                    case AjaxColorStyle.White:
                        _accordion.HeaderCssClass = "ajaxcm_header_unselected2";
            #if VS90
                        _accordion.HeaderSelectedCssClass = "ajaxcm_header_selected2";
            #endif
                        _accordion.ContentCssClass = "ajaxcm_content3";
                        break;
                    case AjaxColorStyle.Black:
                        _accordion.HeaderCssClass = "ajaxcm_header_unselected2";
            #if VS90
                        _accordion.HeaderSelectedCssClass = "ajaxcm_header_selected1";
            #endif
                        _accordion.ContentCssClass = "ajaxcm_content4";
                        break;
                }
            }
            _accordion.FadeTransitions = true;
            _accordion.FramesPerSecond = 40;
            _accordion.TransitionDuration = 250;
            _accordion.AutoSize = AutoSize.Limit;
            #if VS90
            _accordion.RequireOpenedPane = true;
            _accordion.SuppressHeaderPostbacks = true;
            #endif
            foreach (AjaxMenuRootItem rootItem in rootItems)
            {
                AccordionPane pane = new AccordionPane();
                pane.Header = this.UserProvideStyle ? new CollapseMenuHeaderTemplate(rootItem, true, this.ColorStyle) : new CollapseMenuHeaderTemplate(rootItem, false, this.ColorStyle);
                pane.Content = new CollapseMenuContentTemplate(rootItem.Items, this.Target);
                _accordion.Panes.Add(pane);
            }
            this.Controls.Add(_accordion);
        }
コード例 #14
0
    protected void GenarateMainMenu()
    {
        #region 生成主菜单datatable
        DataTable dt = Right_Module_BLL.GetBrowseMoudleByUser(Session["UserName"].ToString());
        DataRow[] RootRows = dt.Select("SuperID=1");
        if (dt != null && RootRows.Length > 0)
        {
            for (int i = 0; i < RootRows.Length; i++)
            {
                DataRow dr = RootRows[i];
                int superid = (int)dr["SuperID"];
                int menuid = (int)dr["ID"];

                if (superid == 1)
                {
                    AjaxControlToolkit.AccordionPane p = new AjaxControlToolkit.AccordionPane();
                    p.ID = "AccordionPane" + menuid.ToString();
                    HyperLink hy = new HyperLink();
                    hy.Text = (string)dr["Name"];
                    p.HeaderContainer.Controls.Add(hy);

                    TreeView tr = new TreeView();
                    tr.ImageSet = TreeViewImageSet.Custom;
                    tr.ShowExpandCollapse = true;
                    tr.ExpandImageUrl = "~/Images/icon/TreeExpand.gif";
                    tr.NoExpandImageUrl = "~/Images/icon/TreeNode.gif";
                    tr.CollapseImageUrl = "~/Images/icon/TreeCollapse.gif";

                    tr.SelectedNodeStyle.Font.Bold = true;
                    tr.SelectedNodeStyle.ForeColor = System.Drawing.Color.Red;
                    tr.SelectedNodeStyle.BackColor = System.Drawing.Color.Yellow;
                    tr.EnableViewState = true;

                    GenareateSubMenu(dt, i, tr.Nodes, menuid);
                    tr.SelectedNodeChanged += tr_SelectedNodeChanged;
                    tr.TreeNodePopulate += tr_TreeNodePopulate;

                    p.ContentContainer.Controls.Add(tr);

                    Ac_MainMenu.Panes.Add(p);

                    #region 只有当前已选择的树节点及至所有父节点才展开,其余折叠
                    if (Session["ActiveRootNode"] != null && (int)Session["ActiveRootNode"] == i && ViewState["CurrentRootNode"] != null)
                    {
                        string nodepath = (string)ViewState["CurrentRootNode"];

                        TreeNode node = tr.FindNode(nodepath);
                        if (node != null)
                        {
                            //node.ImageUrl = "~/Images/icon/TreeCollapse.gif";
                            node.ExpandAll();
                        }
                    }
                    #endregion

                }
            }

            if (Session["ActiveRootNode"] != null) Ac_MainMenu.SelectedIndex = (int)Session["ActiveRootNode"];
            //wc.DataSource = dt;
        }
        else
            Response.Write("对不起,当前用户没有分配任何浏览权限!");
        #endregion
    }
コード例 #15
0
    protected void GenarateMainMenu()
    {
        #region 生成主菜单datatable
        DataTable dt       = Right_Module_BLL.GetBrowseMoudleByUser(Session["UserName"].ToString());
        DataRow[] RootRows = dt.Select("SuperID=1");
        if (dt != null && RootRows.Length > 0)
        {
            for (int i = 0; i < RootRows.Length; i++)
            {
                DataRow dr      = RootRows[i];
                int     superid = (int)dr["SuperID"];
                int     menuid  = (int)dr["ID"];

                if (superid == 1)
                {
                    AjaxControlToolkit.AccordionPane p = new AjaxControlToolkit.AccordionPane();
                    p.ID = "AccordionPane" + menuid.ToString();
                    HyperLink hy = new HyperLink();
                    hy.Text = (string)dr["Name"];
                    p.HeaderContainer.Controls.Add(hy);

                    TreeView tr = new TreeView();
                    tr.ImageSet           = TreeViewImageSet.Custom;
                    tr.ShowExpandCollapse = true;
                    tr.ExpandImageUrl     = "~/Images/icon/TreeExpand.gif";
                    tr.NoExpandImageUrl   = "~/Images/icon/TreeNode.gif";
                    tr.CollapseImageUrl   = "~/Images/icon/TreeCollapse.gif";

                    tr.SelectedNodeStyle.Font.Bold = true;
                    tr.SelectedNodeStyle.ForeColor = System.Drawing.Color.Red;
                    tr.SelectedNodeStyle.BackColor = System.Drawing.Color.Yellow;
                    tr.EnableViewState             = true;

                    GenareateSubMenu(dt, i, tr.Nodes, menuid);
                    tr.SelectedNodeChanged += tr_SelectedNodeChanged;
                    tr.TreeNodePopulate    += tr_TreeNodePopulate;

                    p.ContentContainer.Controls.Add(tr);

                    Ac_MainMenu.Panes.Add(p);

                    #region 只有当前已选择的树节点及至所有父节点才展开,其余折叠
                    if (Session["ActiveRootNode"] != null && (int)Session["ActiveRootNode"] == i && ViewState["CurrentRootNode"] != null)
                    {
                        string nodepath = (string)ViewState["CurrentRootNode"];

                        TreeNode node = tr.FindNode(nodepath);
                        if (node != null)
                        {
                            //node.ImageUrl = "~/Images/icon/TreeCollapse.gif";
                            node.ExpandAll();
                        }
                    }
                    #endregion
                }
            }

            if (Session["ActiveRootNode"] != null)
            {
                Ac_MainMenu.SelectedIndex = (int)Session["ActiveRootNode"];
            }
            //wc.DataSource = dt;
        }
        else
        {
            Response.Write("对不起,当前用户没有分配任何浏览权限!");
        }
        #endregion
    }
コード例 #16
0
ファイル: Cuestionario.aspx.cs プロジェクト: martinherr3/blpm
        /// <summary>
        /// Generars the esqueleto.
        /// </summary>
        /// <param name="entidad">The entidad.</param>
        private void generarEsqueleto(Encuesta entidad)
        {
            objBLEncuesta = new BLEncuesta();

            //objBLEncuestaDisponible = new BLEncuestaDisponible();

            objBLPregunta = new BLPregunta();

            //List<CategoriaPregunta> listaCategorias = objBLEncuesta.GetCategoriasPorEncuesta(encuestaSeleccionada.encuesta);

            if (listaCategorias.Count == 0)
                listaCategorias = objBLEncuesta.GetCategoriasPorEncuesta(entidad);

            //lblNombreEncuesta.Text = encuestaSeleccionada.encuesta.nombreEncuesta;
            lblNombreEncuesta.Text = entidad.nombreEncuesta;

            Label lblCategoria;

            AjaxControlToolkit.AccordionPane pn;
            int i = 0;
            int contador = 0;
            List<string> textoPregunta = new List<string>();
            foreach (CategoriaPregunta categoria in listaCategorias)
            {
                List<Pregunta> preguntasPorCategoria = objBLPregunta.GetPreguntasPorCategoria(categoria, entidad);

                lblCategoria = new Label();

                lblCategoria.Text = categoria.nombre;

                pn = new AjaxControlToolkit.AccordionPane();
                pn.ID = "Panel_" + i;

                pn.HeaderContainer.Controls.Add(lblCategoria);

                if (preguntasPorCategoria.Count > 0)
                {
                    Label lblPregunta;

                    foreach (Pregunta pregunta in preguntasPorCategoria)
                    {
                        contador++;
                        Panel panelRespuesta = new Panel();
                        panelRespuesta.ID = "pregunta_" + contador.ToString();

                        //PREGUNTA
                        lblPregunta = new Label();

                        textoPregunta = new List<string>();

                        textoPregunta = UIUtilidades.StringWrap(pregunta.textoPregunta, 130);

                        foreach (string item in textoPregunta)
                            lblPregunta.Text += item + "<br />";

                        lblPregunta.Font.Bold = true;
                        lblPregunta.Font.Size = 11;
                        //lblPregunta.BorderWidth = 1;
                        //lblPregunta.Width = 990;

                        panelRespuesta.Controls.Add(lblPregunta);
                        //panelRespuesta.Controls.Add(new LiteralControl("<br/>"));

                        respuestaSkeleton.pregunta = pregunta;

                        Respuesta miRespuesta = null;
                        //RESPUESTA
                        if (pregunta.escala.nombre.Equals("Conceptual literal"))
                        {
                            TextBox txtRespuesta = new TextBox();
                            txtRespuesta.ID = "respuesta_" + pregunta.idPregunta.ToString();
                            txtRespuesta.Rows = 5;
                            txtRespuesta.Columns = 75;
                            txtRespuesta.AutoPostBack = false;
                            txtRespuesta.CssClass = "txtMultilinea99";
                            txtRespuesta.TextMode = TextBoxMode.MultiLine;
                            txtRespuesta.Wrap = false;
                            txtRespuesta.MaxLength = 4000;

                            if (ListaRespuestas != null)
                            {
                                miRespuesta = ListaRespuestas.Find(p => p.pregunta.textoPregunta == txtRespuesta.ID);
                                if (miRespuesta != null) txtRespuesta.Text = miRespuesta.respuestaTextual;
                            }
                            txtRespuesta.TextChanged += new EventHandler(this.text_Changed);
                            txtRespuesta.Attributes.Add("onBlur", "GuardarRespuesta(this);");

                            panelRespuesta.Controls.Add(new LiteralControl("<br/>"));
                            panelRespuesta.Controls.Add(txtRespuesta);
                            panelRespuesta.Controls.Add(new LiteralControl("<br/>"));
                        }
                        else
                        {
                            AjaxControlToolkit.Rating rating = new AjaxControlToolkit.Rating();

                            rating.ID = "respuesta_" + pregunta.idPregunta.ToString();
                            rating.MaxRating = 5;

                            rating.StarCssClass = "ratingStar";
                            rating.WaitingStarCssClass = "savedRatingStar";
                            rating.FilledStarCssClass = "filledRatingStar";
                            rating.EmptyStarCssClass = "emptyRatingStar";
                            rating.AutoPostBack = false;

                            if (ListaRespuestas != null)
                            {
                                miRespuesta = ListaRespuestas.Find(p => p.pregunta.textoPregunta == rating.ID);
                                if (miRespuesta != null) rating.CurrentRating = miRespuesta.respuestaSeleccion;
                            }
                            rating.Changed += new AjaxControlToolkit.RatingEventHandler(rating_Changed);

                            panelRespuesta.Controls.Add(new LiteralControl("<br/>"));
                            panelRespuesta.Controls.Add(rating);
                            panelRespuesta.Controls.Add(new LiteralControl("<br/>"));
                            cantRespuestasMinimas++;
                        }

                        pn.ContentContainer.Controls.Add(panelRespuesta);
                        pn.ContentContainer.Controls.Add(new LiteralControl("<br/>"));
                    }
                }
                CuestionarioAccordion.Panes.Add(pn);
                ++i;
            }
        }
コード例 #17
0
    public void PopulateAcrDynamically()
    {
        HyperLink lbTitle;
        Literal   litdd;

        AjaxControlToolkit.AccordionPane pn;
        int i    = 0;
        int flag = 0;

        DataTable dtAllModule = ObjCom.GetAccodion(Session["UserId"].ToString()).DefaultView.ToTable(true, "Module_Id");

        foreach (DataRow datarow in dtAllModule.Rows)
        {
            DataTable dtM = new DataView(ObjCom.GetModuleName(), "Module_Id='" + datarow["Module_Id"].ToString() + "'", "", DataViewRowState.CurrentRows).ToTable();
            lbTitle = new HyperLink();
            litdd   = new Literal();
            string strText = string.Empty;
            if (Session["lang"].ToString() == "1")
            {
                lbTitle.CssClass = "FrmTitle";
                lbTitle.Text     = dtM.Rows[0]["Module_Name"].ToString();

                lbTitle.NavigateUrl = dtM.Rows[0]["DashBoard_Url"].ToString();
            }
            else
            {
                lbTitle.Text        = dtM.Rows[0]["Module_Name_L"].ToString();
                lbTitle.NavigateUrl = dtM.Rows[0]["DashBoard_Url"].ToString();
            }

            DataTable dtAllChild = new DataView(ObjCom.GetAccodion(Session["UserId"].ToString()), "Module_Id=" + datarow["Module_Id"].ToString() + "", "Order_Appear", DataViewRowState.CurrentRows).ToTable();


            strText = "<table>";

            foreach (DataRow childrow in dtAllChild.Rows)
            {
                DataTable dtObject = new DataView(ObjCom.GetObjectName(), "Object_Id='" + childrow["Object_Id"].ToString() + "'", "", DataViewRowState.CurrentRows).ToTable();

                if (Session["AccordianId"] != null)
                {
                    string strAccordianId = Session["AccordianId"].ToString();
                    if (strAccordianId != null && strAccordianId != "0")
                    {
                        if (datarow["Module_Id"].ToString().Trim() == strAccordianId)
                        {
                            flag = 1;
                        }
                    }
                }


                if (Session["lang"].ToString() == "1")
                {
                    strText = strText + "<tr><td align='left'><a href=" + dtObject.Rows[0]["Page_Url"].ToString() + " class=acc>" + dtObject.Rows[0]["Object_Name"].ToString() + "</a></tr></td>";
                }
                else
                {
                    strText = strText + "<tr><td align='left'><a href=" + dtObject.Rows[0]["Page_Url"].ToString() + " class=acc>" + dtObject.Rows[0]["Object_Name_L"].ToString() + "</a></tr></td>";
                }
            }
            strText    = strText + "</table>";
            litdd.Text = strText;
            pn         = new AjaxControlToolkit.AccordionPane();
            pn.ID      = "Pane" + i;
            pn.HeaderContainer.Controls.Add(lbTitle);
            if (flag == 1)
            {
                flag = 0;
                acrDynamic.SelectedIndex = i;
            }
            pn.ContentContainer.Controls.Add(litdd);
            acrDynamic.Panes.Add(pn);
            ++i;
        }
    }
コード例 #18
0
 /* Submenu */
 protected void Create_SubMenu(AccordionPane pane, string subMenuId, string subMenuText, bool enterRequired) {
     Label submenu = new Label();
     submenu.Text = subMenuText.Substring(0, 1).ToUpper() + subMenuText.Substring(1);;
     string temp = subMenuId.Substring(0, 3); 
     submenu.ID = temp+""+subMenuText;
     submenu.CssClass = "labelMenu";
     submenu.Attributes.Add("onclick", "loadHTMLonDiv('"+subMenuText.Replace(" ", string.Empty)+".aspx', 'content');");
     pane.ContentContainer.Controls.Add(submenu);
     if(enterRequired)
         pane.ContentContainer.Controls.Add(new LiteralControl("<br />"));
     
 }
コード例 #19
0
        public void napuniAccordion2()
        {
            // povuci semafore
            IEnumerable<tblSemafor> semafori = from s in db.tblSemafors select s;

            foreach (tblSemafor semafor in semafori) {
                AccordionPane aPaneSemafor = new AccordionPane();
                aPaneSemafor.ID = "aPaneSemafor" + semafor.Id.ToString();
                aPaneSemafor.HeaderContainer.Controls.Add(new LiteralControl(semafor.naziv));

                Button btnDodajStranicu = new Button();
                btnDodajStranicu.ID = "btnDodajStranicuNaSemafor_ID" + semafor.Id.ToString();
                btnDodajStranicu.Text = "Dodaj Stranicu";
                btnDodajStranicu.CssClass = "AccordianAddEdditControls";
                btnDodajStranicu.Click += (sender, e) => dodajStranicuSemafora(sender, e, semafor.Id);
                aPaneSemafor.ContentContainer.Controls.Add(btnDodajStranicu);

                // dodaj content stranica
                Accordion AccordianStranica = new Accordion();
                AccordianStranica.ID = "AccordionStranicaSemafora" + semafor.Id.ToString();

                //if (!IsPostBack) {
                //    AccordianStranica.SelectedIndex = 0;
                //}

                AccordianStranica.FadeTransitions = false;
                AccordianStranica.FramesPerSecond = 50;
                AccordianStranica.RequireOpenedPane = false;
                AccordianStranica.HeaderCssClass = "AccordianStranicaNaslov sjena";
                AccordianStranica.TransitionDuration = 90;

                // povuci stranice
                IEnumerable<tblStranica> stranice = from str in db.tblStranicas where str.semaforID == semafor.Id select str;

                foreach (tblStranica stranica in stranice) {
                    AccordionPane aPaneStranica = new AccordionPane();
                    aPaneStranica.ID = "AccordianStranicaStranice" + stranica.Id.ToString();
                    aPaneStranica.HeaderContainer.Controls.Add(new LiteralControl(stranica.naziv));

                    LinkButton btnEditStranice = new LinkButton();
                    btnEditStranice.ID = "buttonMijenjajStranicu";
                    btnEditStranice.Text = "promijeni";
                    btnEditStranice.CssClass = "AccordianAddEdditControls";
                    btnEditStranice.Click += (sender, e) => mijenjajStranicuSemafora(sender, e, stranica.Id);
                    aPaneStranica.HeaderContainer.Controls.Add(btnEditStranice);

                    // razmak
                    aPaneStranica.HeaderContainer.Controls.Add(new LiteralControl("|"));

                    LinkButton btnBrisiStranicu = new LinkButton();
                    btnBrisiStranicu.ID = "buttonBrisiStranicu";
                    btnBrisiStranicu.Text = "briši";
                    btnBrisiStranicu.CssClass = "AccordianAddEdditControls";
                    btnBrisiStranicu.Click += (sender, e) => brisiStranicuSemafora(sender, e, stranica.Id);
                    aPaneStranica.HeaderContainer.Controls.Add(btnBrisiStranicu);

                    // dodaj content redova
                    Accordion AccordianRedova = new Accordion();
                    AccordianRedova.ID = "AccordionRedovaStranica" + stranica.Id.ToString();
                    AccordianRedova.SelectedIndex = 100;
                    AccordianRedova.FadeTransitions = false;
                    AccordianRedova.FramesPerSecond = 50;
                    AccordianRedova.RequireOpenedPane = false;
                    AccordianRedova.HeaderCssClass = "AccordianRedNaslov sjena";
                    AccordianStranica.TransitionDuration = 80;

                    //povuciredove
                    IEnumerable<tblRedak> redovi = from r in db.tblRedaks where r.stranicaID == stranica.Id select r;

                    foreach (tblRedak red in redovi) {
                        AccordionPane aPaneRedova = new AccordionPane();
                        aPaneRedova.ID = "AcordianStranicaRedova" + red.id.ToString();
                        aPaneRedova.HeaderContainer.Controls.Add(new LiteralControl("Redak_" + red.id.ToString()));

                        // tu sada treba napraviti kontrolu za prikaz celija i dodati je u aPaneRedova ContentContainer

                        Panel prvi = new Panel();
                        prvi.Width = 300;
                        prvi.Height = 300;
                        prvi.BorderStyle = BorderStyle.Solid;
                        prvi.BorderWidth = 2;

                        aPaneRedova.ContentContainer.Controls.Add(prvi);
                        //aPaneRedova.ContentContainer.Controls.Add(new LiteralControl("unutra"));

                        AccordianRedova.Panes.Add(aPaneRedova);

                    }

                    aPaneStranica.ContentContainer.Controls.Add(AccordianRedova);

                    AccordianStranica.Panes.Add(aPaneStranica);
                }

                aPaneSemafor.ContentContainer.Controls.Add(AccordianStranica);

                SemaforiAccordion.Panes.Add(aPaneSemafor);

            }
        }
    /// <summary>
    /// Prepares the layout of the web part.
    /// </summary>
    protected override void PrepareLayout()
    {
        StartLayout(true);

        // Pane headers
        string[] headers = TextHelper.EnsureLineEndings(PaneHeaders, "\n").Split('\n');

        for (int i = 1; i <= Panes; i++)
        {
            // Create new pane
            AccordionPane pane = new AccordionPane();
            pane.ID = "pane" + i;

            // Prepare the header
            string header = null;
            if (headers.Length >= i)
            {
                header = ResHelper.LocalizeString(headers[i - 1]);
            }
            if (String.IsNullOrEmpty(header))
            {
                header = "Pane " + i;
            }

            string title = header;

            if (IsDesign)
            {
                header = EditableWebPartProperty.GetHTMLCode(null, this, "PaneHeaders", i, EditablePropertyTypeEnum.TextBox, header, null, null, null, true);
            }
            else
            {
                header = EditableWebPartProperty.ApplyReplacements(HttpUtility.HtmlEncode(header), false);
            }

            pane.Header = new TextTransformationTemplate(header);
            acc.Panes.Add(pane);

            var zone = AddZone(ID + "_" + i, title, pane.ContentContainer);
            zone.Wireframe = true;
        }

        // Setup the accordion
        if ((ActivePaneIndex >= 1) && (ActivePaneIndex <= acc.Panes.Count))
        {
            acc.SelectedIndex = ActivePaneIndex - 1;
        }

        // If no active pane is selected and doesn't require opened one, do not preselect any
        if (!acc.RequireOpenedPane && (ActivePaneIndex < 0))
        {
            acc.SelectedIndex = -1;
        }

        // Wireframe design
        acc.CssClass = "WireframeAccordion";
        acc.ContentCssClass = "WireframeAccordionContent";
        acc.HeaderCssClass = "WireframeAccordionHeader";
        acc.HeaderSelectedCssClass = "WireframeAccordionSelectedHeader";

        acc.RequireOpenedPane = RequireOpenedPane;
        acc.AutoSize = AutoSize.None;

        // Set width / height
        string width = Width;
        if (!String.IsNullOrEmpty(width))
        {
            acc.Width = new Unit(width);
        }

        if (IsDesign && AllowDesignMode)
        {
            // Pane actions
            if (Panes > 1)
            {
                AppendRemoveAction(GetString("Layout.RemoveLastPane"), "Panes", "icon-times", null);
                Append(" ");
            }

            AppendAddAction(GetString("Layout.AddPane"), "Panes", "icon-plus", null);

            resElem.ResizedElementID = acc.ClientID;
        }

        // Render the actions
        string actions = FinishLayout(false);
        if (!String.IsNullOrEmpty(actions))
        {
            pnlActions.Visible = true;
            ltlActions.Text = actions;
        }
    }
コード例 #21
0
        // Create the new control hierarchy of AccordionPanes
        // (using the DataSource if specificed)
        protected virtual void CreateControlHierarchy(bool useDataSource)
        {
            var         count      = -1;
            IEnumerable dataSource = null;
            var         itemsArray = new List <AccordionPane>();

            if (!useDataSource)
            {
                var viewCount = ViewState[ItemCountViewStateKey];

                // ViewState must have a non-null value for ItemCount because we check for
                // this in CreateChildControls
                if (viewCount != null)
                {
                    count = (int)viewCount;
                    if (count != -1)
                    {
                        var dummyList = new List <object>(count);
                        for (var i = 0; i < count; i++)
                        {
                            dummyList.Add(null);
                        }
                        dataSource          = dummyList;
                        itemsArray.Capacity = count;
                    }
                }
            }
            else
            {
                dataSource = GetData();
                count      = 0;
                var collection = dataSource as ICollection;
                if (collection != null)
                {
                    itemsArray.Capacity = collection.Count;
                }
            }

            if (dataSource != null)
            {
                var index = 0;
                foreach (var dataItem in dataSource)
                {
                    var ap = new AccordionPane();
                    ap.ID = String.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}_Pane_{1}", ID, index.ToString(CultureInfo.InvariantCulture));

                    Controls.Add(ap);

                    CreateItem(dataItem, index, AccordionItemType.Header, ap.HeaderContainer, HeaderTemplate, useDataSource);
                    CreateItem(dataItem, index, AccordionItemType.Content, ap.ContentContainer, ContentTemplate, useDataSource);

                    itemsArray.Add(ap);

                    count++;
                    index++;
                }
            }

            // If we're binding, save the number of items contained in the repeater for use in round-trips
            if (useDataSource)
            {
                ViewState[ItemCountViewStateKey] = ((dataSource != null) ? count : -1);
            }
        }
コード例 #22
0
        // Create the new control hierarchy of AccordionPanes
        // (using the DataSource if specificed)
        protected virtual void CreateControlHierarchy(bool useDataSource)
        {
            var count = -1;
            IEnumerable dataSource = null;
            var itemsArray = new List<AccordionPane>();

            if(!useDataSource) {
                var viewCount = ViewState[ItemCountViewStateKey];

                // ViewState must have a non-null value for ItemCount because we check for
                // this in CreateChildControls
                if(viewCount != null) {
                    count = (int)viewCount;
                    if(count != -1) {
                        var dummyList = new List<object>(count);
                        for(var i = 0; i < count; i++)
                            dummyList.Add(null);
                        dataSource = dummyList;
                        itemsArray.Capacity = count;
                    }
                }
            } else {
                dataSource = GetData();
                count = 0;
                var collection = dataSource as ICollection;
                if(collection != null)
                    itemsArray.Capacity = collection.Count;
            }

            if(dataSource != null) {
                var index = 0;
                foreach(var dataItem in dataSource) {
                    var ap = new AccordionPane();
                    ap.ID = String.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}_Pane_{1}", ID, index.ToString(CultureInfo.InvariantCulture));

                    Controls.Add(ap);

                    CreateItem(dataItem, index, AccordionItemType.Header, ap.HeaderContainer, HeaderTemplate, useDataSource);
                    CreateItem(dataItem, index, AccordionItemType.Content, ap.ContentContainer, ContentTemplate, useDataSource);

                    itemsArray.Add(ap);

                    count++;
                    index++;
                }
            }

            // If we're binding, save the number of items contained in the repeater for use in round-trips
            if(useDataSource)
                ViewState[ItemCountViewStateKey] = ((dataSource != null) ? count : -1);
        }
コード例 #23
0
        public void napuniAccordion()
        {
            // povuci semafore
            IEnumerable<tblSemafor> semafori = from s in db.tblSemafors
                                               select s;

            // dodaj accordion pane za svaki semafor

            foreach (tblSemafor semafor in semafori) {
                AccordionPane apaneSemafor = new AccordionPane();
                apaneSemafor.ID = "AccordionPaneSemaforID_" + semafor.Id.ToString();

                // generiramo header pane-a
                LinkButton semaforNaslov = new LinkButton();
                semaforNaslov.ID = "linkButtonNaslovSemaforID_" + semafor.Id.ToString();
                semaforNaslov.Text = semafor.naziv;

                apaneSemafor.HeaderContainer.Controls.Add(semaforNaslov);

                // generiramo content za Semafor pane ContentContainer
                IEnumerable<tblStranica> stranice = from str in db.tblStranicas
                                                    where str.semaforID == semafor.Id
                                                    select str;

                // container na koji ide content i navigacija
                Panel containerPanel = new Panel();
                containerPanel.CssClass = "pnl1Class";
                containerPanel.ID = "containerPanelSemaforID_" + semafor.Id.ToString();

                // na ovaj panel ide sav content, tj popis stranica
                Panel contentPanel = new Panel();
                contentPanel.CssClass = "AccordionContentPaneContent";

                containerPanel.Controls.Add(contentPanel);
                // dodaj ga u semafor content
                apaneSemafor.ContentContainer.Controls.Add(containerPanel);

                // accordion stranica
                foreach (tblStranica stranica in stranice) {
                    Accordion StraniceAccordion = new Accordion();
                    //StraniceAccordion.RequireOpenedPane = false;
                    //StraniceAccordion.SelectedIndex = 1000;

                    //StraniceAccordion.Attributes["runat"] = "server";
                    StraniceAccordion.Attributes["SelectedIndex"] = "1000";
                    StraniceAccordion.Attributes["FadeTransitions"] = "false";
                    StraniceAccordion.Attributes["FramesPerSecond"] = "30";
                    StraniceAccordion.Attributes["RequireOpenedPane"] = "False";
                    StraniceAccordion.Attributes["HeaderCssClass"] = "AccordianSemaforNaslov";

                    StraniceAccordion.ID = "StranicaAccordionID_" + stranica.Id.ToString();
                    AccordionPane apStranica = new AccordionPane();
                    apStranica.ID = "AccordionPaneStranicaID_" + stranica.Id.ToString();

                    apStranica.HeaderContainer.ID = "HeaderContainterStranicaID_" + stranica.Id.ToString();
                    LinkButton naslovStranice = new LinkButton();

                    naslovStranice.ID = "linkButtonNaslovStraniceID_" + stranica.Id.ToString();
                    naslovStranice.Text = stranica.naziv;
                    naslovStranice.Click += (sender, e) => mijenjajStranicuSemafora(sender, e, stranica.Id);

                    // generiramo header pane-a Stranice

                    //apStranica.HeaderContainer.Controls.Add(naslovStranice);
                    apStranica.HeaderContainer.Controls.Add(new LiteralControl("Ovo je header"));

                    // dodaj svakom headeru neki redak bezveze za test
                    apStranica.ContentContainer.Controls.Add(new LiteralControl("ovo je interni"));

                    /*
                    // sad ide content, a to su zapravo redovi
                    IEnumerable<tblRedak> retci = from r in db.tblRedaks where r.stranicaID == stranica.Id select r;

                    Panel containerPanelRedak = new Panel();
                    containerPanelRedak.CssClass = "pnl1Class";
                    containerPanelRedak.ID = "containerPanelSemaforID_" + semafor.Id.ToString();

                    // na ovaj panel ide sav content, tj popis stranica
                    Panel contentPanelRedak = new Panel();
                    contentPanelRedak.CssClass = "AccordionContentPaneContent";

                    containerPanelRedak.Controls.Add(contentPanelRedak);
                    // dodaj ga u stranica content
                    apStranica.ContentContainer.Controls.Add(containerPanelRedak);

                    foreach (tblRedak redak in retci) {
                        Accordion RetciAccordion = new Accordion();
                        RetciAccordion.ID = "RedakAccordionID_" + redak.id.ToString();
                        AccordionPane apRedak = new AccordionPane();
                        apRedak.ID = "AccordionPaneRedakID_" + redak.id.ToString();

                        apRedak.HeaderContainer.ID = "HeaderContainerRedakID_" + redak.id.ToString();

                        LinkButton naslovRetka = new LinkButton();
                        naslovRetka.ID = "linkButtonNaslovRetkaID_" + redak.id.ToString();
                        naslovRetka.Text = "neki naslov retka";

                        //naslovRetka.Click +=

                        apRedak.HeaderContainer.Controls.Add(naslovRetka);

                        RetciAccordion.Panes.Add(apRedak);
                        contentPanelRedak.Controls.Add(RetciAccordion);

                    }   //kraj foreach za dodavanje redaka

                    */

                    StraniceAccordion.Panes.Add(apStranica);
                    //testAcco.Panes.Add(apStranica);

                    //dodajemo AccoridionStranica na content Pane accordiona Semafora
                    contentPanel.Controls.Add(StraniceAccordion);

                } // kraj foreach za dodavanje stranica

                //dodaj gumb za dodavanje stranice
                LinkButton btnDodajStranicu = new LinkButton();
                btnDodajStranicu.ID = "linkButtonDodajStranicu_sID" + semafor.Id.ToString(); ;
                btnDodajStranicu.Text = "Dodaj Stranicu";

                //dodaj gumb za brisanje stranice
                LinkButton btnBrisiStranicu = new LinkButton();
                btnBrisiStranicu.ID = "linkButtonBrisiStranicu_sID" + semafor.Id.ToString(); ;
                btnBrisiStranicu.Text = "Obriši Stranicu";

                Panel navigationContainer = new Panel();
                navigationContainer.ID = "DodajStranicu";
                navigationContainer.CssClass = "AccordionContentPaneNavigacija";

                // dodaj kontrole na stranicu
                navigationContainer.Controls.Add(btnDodajStranicu);
                navigationContainer.Controls.Add(new LiteralControl("&nbsp;"));
                navigationContainer.Controls.Add(btnBrisiStranicu);

                btnDodajStranicu.Click += (sender, e) => dodajStranicuSemafora(sender, e, semafor.Id);
                //apSemafor.ContentContainer.Controls.AddAt(0, divZaDodajStranicuLinkbutton);
                containerPanel.Controls.Add(navigationContainer);

                // dodaj pane u accordion
                SemaforiAccordion.Panes.Add(apaneSemafor);

            } //kraj foreach za dodavanje semafora
        }
コード例 #24
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string XMLFileName;
        string AppId = "";
        string Style = "";
        string Password = "";

        bool LNumValid = true;
        Response.Flush();
        AppId = "ISS";

        Style = "AccMnt";
        oMDBF.Loginid = Session["mgUSERID"].ToString();

        XMLFileName = Request.ServerVariables["APPL_PHYSICAL_PATH"] + "XML\\" + "Menu_" + AppId + "_" + oMDBF.Loginid + ".xml";

        if (!File.Exists(XMLFileName))
        {
            oMDBF.WriteXMLNew(AppId, oMDBF.Loginid, XMLFileName);
        }
        else
        {
            File.Delete(XMLFileName);
            oMDBF.WriteXMLNew(AppId, oMDBF.Loginid, XMLFileName);
        }

        //MySource.DataFile = XMLFileName;

        DataSet dsMenu = new DataSet();
        dsMenu.ReadXml(XMLFileName);
        DataTable dtMenu = new DataTable();
        dtMenu = dsMenu.Tables[0].Copy();
        if (dtMenu.Rows.Count > 0)
        {
            AccordionPane pn;

            for (int i = 0; i < dtMenu.Rows.Count; i++)
            {
                if (dtMenu.Rows[i]["MsMenuItem_Id_0"].ToString() == "0")
                {
                    Label lbTitle = new Label();
                    Label lbContent = new Label();
                    StringBuilder sb = new StringBuilder();
                    DataRow[] parentMenus = dtMenu.Select("MsMenuItem_Id_0 = " + dtMenu.Rows[i]["MsMenuItem_Id"].ToString());
                    String UnOrderLsit = GenerateUL(parentMenus, dtMenu, sb);
                    lbTitle.Text = dtMenu.Rows[i]["title"].ToString();
                    //TreeView TrV = GenerateTree(parentMenus, dtMenu, lbTitle.Text, i);
                    //TrV.ID = "TreeView" + i;

                    lbContent.Text = UnOrderLsit ;
                    pn = new AjaxControlToolkit.AccordionPane();
                    pn.ID = "Pane" + i;
                    pn.HeaderContainer.Controls.Add(lbTitle);
                    pn.ContentContainer.Controls.Add(lbContent);
                    acrDynamic.Panes.Add(pn);

                }
            }
        }

        // Code next..not used
        //if (LNumValid)
        //{
        //    if (!File.Exists(XMLFileName))
        //    {
        //        oMDBF.WriteXMLNew(AppId, oMDBF.Loginid, XMLFileName);
        //    }
        //    else
        //    {
        //        File.Delete(XMLFileName);
        //        oMDBF.WriteXMLNew(AppId, oMDBF.Loginid, XMLFileName);
        //    }
        //    MySource.DataFile = XMLFileName;
        //    TreeNodeBinding tNode = new TreeNodeBinding();
        //    tNode.DataMember = "MsMenuItem";
        //    tNode.TextField = "title";
        //    tNode.TargetField = "result";
        //    tNode.NavigateUrlField = "url";
        //    tNode.ValueField = "menuid";
        //    //tNode.ImageUrlField = "imageUrl";
        //    TreeView2.DataBindings.Add(tNode);
        //}
        //else
        //{
        //    MySource.DataFile = XMLFileName;
        //    TreeNodeBinding tNode = new TreeNodeBinding();
        //    tNode.DataMember = "MsMenuItem";
        //    tNode.TextField = "title";
        //    tNode.TargetField = "result";
        //    tNode.NavigateUrlField = "url";
        //    tNode.ValueField = "menuid";

        //    //tNode.ImageUrlField = "imageUrl";
        //    TreeView2.DataBindings.Add(tNode);
        //}
        Password = "";

        //GetAccordionMenu();
    }
コード例 #25
0
 /// <summary>
 /// To bind Dynamic Menu in Accordion 
 /// </summary>
 private void accbind()
 {
     DataTable DtBindMenu = BinMenu();
     DataTable DtMenu = new DataTable();
     DataTable dtMenu1 = new DataTable();
     if (DtBindMenu != null)
     {
         DtMenu = DtBindMenu.DefaultView.ToTable(true, "MenuId", "Menu", "IsActive");
         DataView DvMenu = new DataView(DtMenu);
         DvMenu.Sort = ("MenuId" + " ASC");
         DtMenu = DvMenu.ToTable();
         if (DtMenu.Rows.Count != 0)
         {
             int j = 0;
             AjaxControlToolkit.AccordionPane AccPan;
             int i = 0;     // This is just to use for assigning pane an id
             Label lblMenu;
            //To get Menu Details
             foreach (DataRow Dr in DtMenu.Rows)
             {
                 lblMenu = new Label();
                 lblMenu.Text = Dr["Menu"].ToString();
                 int MenuId = Convert.ToInt16(Dr["MenuID"].ToString());
                 DataTable DtSubMenu = new DataTable();
                 DataView DvBindMenu = DtBindMenu.DefaultView;
                 DvBindMenu.RowFilter = "MenuID = " + MenuId;
                 DtSubMenu = DvBindMenu.ToTable(true, "SubMenuId", "Menu", "IsActive", "Sub Menu", "SubMenuDescription", "SubMenuURL", "MenuID", "SBSRT");
                 AccPan = new AjaxControlToolkit.AccordionPane();
                 AccPan.ID = "Pane" + j;
                 AccPan.HeaderContainer.Controls.Add(lblMenu);
                 DataView DvMenuBind = new DataView(DtSubMenu);
                 DvMenuBind.Sort = ("SBSRT" + " ASC");
                 DtSubMenu = DvMenuBind.ToTable();
                 //To get SubMenu Details of Specific Menu
                 if (DtSubMenu.Rows.Count > 0)
                 {
                     DataColumn DcSrNo = new DataColumn("Sr. No");
                     DtSubMenu.Columns.Add(DcSrNo);
                     for (int s = 0; s < DtSubMenu.Rows.Count; s++)
                     {
                         DtSubMenu.Rows[s][8] = j + 1;
                     }
                     foreach (DataRow DrSubMenu in DtSubMenu.Rows)
                     {
                         Label NewLine = new Label();
                         NewLine.Text = "<br/>";
                         LinkButton lnkSubMenu = new LinkButton();
                         lnkSubMenu.ID = "lnkSubMenu" + i;
                         lnkSubMenu.Text = DrSubMenu["Sub Menu"].ToString();
                         lnkSubMenu.ToolTip = DrSubMenu["SubMenuDescription"].ToString();
                         lnkSubMenu.CommandArgument = DrSubMenu["Sr. No"].ToString();
                         lnkSubMenu.CssClass = DrSubMenu["SubMenuURL"].ToString();
                         lnkSubMenu.EnableTheming = false;
                         lnkSubMenu.Click += new System.EventHandler(lnkSubMenu_Click);
                         AccPan.ContentContainer.Controls.Add(new LiteralControl("<li>"));
                         AccPan.ContentContainer.Controls.Add(lnkSubMenu);
                         i++;
                     }
                 }
                 acdnMaster.Panes.Add(AccPan);
                 ++j;
             }
         }
     }
     else
     {
     }
 }
コード例 #26
0
        /// <summary>
        /// Buscars the preguntas.
        /// </summary>
        private void BuscarPreguntas()
        {
            List<DTRol> listaRoles = new List<DTRol>();
            foreach (ListItem item in lstRoles.Items)
                if (item.Selected)
                    listaRoles.Add(new DTRol() { Nombre = item.Text });

            CuestionarioAccordion.Panes.Clear();

            #region --Preguntas Numéricas--

            listaRespuestaNumericas = new BLRespuesta().GetRespuestaPreguntaAnalisis(encuestaSesion, listaRoles);

            AccordionPane panel;
            Label lblCategoria;
            Table tabla = new Table();

            TableRow fila = new TableRow();
            TableCell celda = new TableCell();
            List<string> textoPregunta = new List<string>();

            foreach (RespuestaPreguntaAnalisis respuesta in listaRespuestaNumericas)
            {
                tabla = new Table();
                tabla.Width = Unit.Percentage(100);
                fila = new TableRow();
                celda = new TableCell();

                textoPregunta = new List<string>();

                textoPregunta = UIUtilidades.StringWrap(respuesta.textoPregunta, 130);

                lblCategoria = new Label();

                foreach (string item in textoPregunta)
                    lblCategoria.Text += item + "<br />";

                //lblCategoria.Text = respuesta.textoPregunta;
                tabla.BorderStyle = BorderStyle.None;
                celda.Controls.Add(lblCategoria);
                celda.Width = Unit.Percentage(90);
                celda.HorizontalAlign = HorizontalAlign.Left;

                fila.Cells.Add(celda);

                celda = new TableCell();
                lblCategoria = new Label();
                lblCategoria.Text = "[Relevancia: " + respuesta.relevancia.ToString().PadLeft(5, 'x') + "%]";
                lblCategoria.Text = lblCategoria.Text.Replace("x", "&nbsp;&nbsp;");

                celda.Controls.Add(lblCategoria);
                celda.HorizontalAlign = HorizontalAlign.Right;

                fila.Cells.Add(celda);
                tabla.Rows.Add(fila);

                panel = new AjaxControlToolkit.AccordionPane();
                panel.ID = "Panel_" + respuesta.idPregunta;

                panel.HeaderContainer.Controls.Add(tabla);
                panel.HeaderContainer.HorizontalAlign = HorizontalAlign.Left;

                ImageButton btnGraficar = new ImageButton();
                btnGraficar.ID = "btnGraficar_" + respuesta.idPregunta.ToString();
                btnGraficar.ToolTip = "Ver Gráfico";
                btnGraficar.ImageUrl = "~/Images/GraficarEncuesta.png";

                btnGraficar.CommandArgument = respuesta.idPregunta.ToString();
                btnGraficar.CommandName = "Graficar";
                btnGraficar.Command += new CommandEventHandler(btnGraficar_Command);

                List<miRespuesta> listaRespuestasPregunta = ObtenerRespuestas(respuesta);

                tabla = new Table();
                tabla.Width = Unit.Percentage(70);

                fila = new TableRow();
                celda = new TableCell();

                GridView grilla = new GridView();
                grilla.CssClass = "DatosLista";
                grilla.SkinID = "gridviewSkinPagerListado";
                grilla.AutoGenerateColumns = true;
                grilla.Width = Unit.Percentage(30);
                grilla.DataSource = listaRespuestasPregunta;
                grilla.DataBind();

                celda.Controls.Add(grilla);
                fila.Cells.Add(celda);

                celda = new TableCell();
                grilla.Width = Unit.Percentage(30);
                celda.VerticalAlign = VerticalAlign.Middle;
                celda.HorizontalAlign = HorizontalAlign.Center;
                celda.Controls.Add(btnGraficar);

                celda.Controls.Add(new LiteralControl(@"<br/><div class='loginDisplay' style='text-align: center'>"));

                celda.Controls.Add(new LiteralControl("[ "));

                LinkButton miLink = new LinkButton();
                miLink.Text = "Ver Gráfico";
                miLink.CommandArgument = respuesta.idPregunta.ToString();
                miLink.CommandName = "Graficar";
                miLink.Command += new CommandEventHandler(btnGraficar_Command);

                celda.Controls.Add(miLink);
                celda.Controls.Add(new LiteralControl(" ]</div>"));

                fila.Cells.Add(celda);

                tabla.Rows.Add(fila);

                panel.ContentContainer.Controls.Add(tabla);

                CuestionarioAccordion.Panes.Add(panel);
            }
            #endregion

            #region --Preguntas Textuales--

            listaRespuestaTextuales = new BLRespuesta().GetRespuestaPreguntaTextual(encuestaSesion, listaRoles);

            foreach (RespuestaPreguntaAnalisis respuesta in listaRespuestaTextuales)
            {
                tabla = new Table();
                tabla.Width = Unit.Percentage(100);
                fila = new TableRow();
                celda = new TableCell();

                textoPregunta = new List<string>();

                textoPregunta = UIUtilidades.StringWrap(respuesta.textoPregunta, 130);

                lblCategoria = new Label();

                foreach (string item in textoPregunta)
                    lblCategoria.Text += item + "<br />";

                tabla.BorderStyle = BorderStyle.None;
                celda.Controls.Add(lblCategoria);
                celda.Width = Unit.Percentage(90);
                celda.HorizontalAlign = HorizontalAlign.Left;

                fila.Cells.Add(celda);

                celda = new TableCell();
                lblCategoria = new Label();
                lblCategoria.Text = "[Relevancia: " + respuesta.relevancia.ToString().PadLeft(5, 'x') + "%]";
                lblCategoria.Text = lblCategoria.Text.Replace("x", "&nbsp;&nbsp;");

                celda.Controls.Add(lblCategoria);
                celda.HorizontalAlign = HorizontalAlign.Right;

                fila.Cells.Add(celda);
                tabla.Rows.Add(fila);

                panel = new AjaxControlToolkit.AccordionPane();
                panel.ID = "Panel_" + respuesta.idPregunta;

                panel.HeaderContainer.Controls.Add(tabla);
                panel.HeaderContainer.HorizontalAlign = HorizontalAlign.Left;

                List<miRespuestaTextual> listaRespuestasTextualesPregunta = ObtenerRespuestasTextuales(respuesta);

                tabla = new Table();
                tabla.Width = Unit.Percentage(70);

                fila = new TableRow();
                celda = new TableCell();

                GridView grilla = new GridView();
                grilla.CssClass = "DatosLista";
                grilla.SkinID = "gridviewSkinPagerListado";
                grilla.AutoGenerateColumns = true;
                grilla.Width = Unit.Percentage(30);
                grilla.DataSource = listaRespuestasTextualesPregunta;
                grilla.DataBind();

                celda.Controls.Add(grilla);
                fila.Cells.Add(celda);

                celda = new TableCell();
                grilla.Width = Unit.Percentage(30);
                celda.VerticalAlign = VerticalAlign.Middle;
                celda.HorizontalAlign = HorizontalAlign.Center;

                celda.Controls.Add(new LiteralControl(@"<div class='loginDisplay' style='text-align: center'>"));

                celda.Controls.Add(new LiteralControl("[ "));

                LinkButton miLink = new LinkButton();
                miLink.Text = "Ver Respuestas";
                miLink.CommandArgument = respuesta.idPregunta.ToString();
                miLink.CommandName = "Respuestas";
                miLink.Command += new CommandEventHandler(btnGraficar_Command);

                celda.Controls.Add(miLink);
                celda.Controls.Add(new LiteralControl(" ]</div>"));

                fila.Cells.Add(celda);

                tabla.Rows.Add(fila);

                panel.ContentContainer.Controls.Add(tabla);

                CuestionarioAccordion.Panes.Add(panel);
            }
            #endregion
        }
コード例 #27
0
ファイル: Cuestionario.aspx.cs プロジェクト: martinherr3/blpm
        /// <summary>
        /// Generars the esqueleto.
        /// </summary>
        /// <param name="entidad">The entidad.</param>
        private void generarEsqueleto(Encuesta entidad)
        {
            objBLEncuesta = new BLEncuesta();

            objBLPregunta = new BLPregunta();

            if (listaCategorias.Count == 0)
                listaCategorias = objBLEncuesta.GetCategoriasPorEncuesta(entidad);

            lblNombreEncuesta.Text = entidad.nombreEncuesta;

            Label lblCategoria;

            AjaxControlToolkit.AccordionPane pn;
            int i = 0;
            int contador = 0;
            List<string> textoPregunta = new List<string>();
            foreach (CategoriaPregunta categoria in listaCategorias)
            {
                List<Pregunta> preguntasPorCategoria = objBLPregunta.GetPreguntasPorCategoria(categoria, entidad);

                lblCategoria = new Label();

                lblCategoria.Text = categoria.nombre;

                pn = new AjaxControlToolkit.AccordionPane();
                pn.ID = "Panel_" + i;

                pn.HeaderContainer.Controls.Add(lblCategoria);

                if (preguntasPorCategoria.Count > 0)
                {
                    Label lblPregunta;

                    foreach (Pregunta pregunta in preguntasPorCategoria)
                    {
                        contador++;
                        Panel panelRespuesta = new Panel();
                        panelRespuesta.ID = "pregunta_" + contador.ToString();

                        //PREGUNTA
                        lblPregunta = new Label();

                        textoPregunta = new List<string>();

                        textoPregunta = UIUtilidades.StringWrap(pregunta.textoPregunta, 130);

                        foreach (string item in textoPregunta)
                            lblPregunta.Text += item + "<br />";

                        lblPregunta.Font.Bold = true;
                        lblPregunta.Font.Size = 11;

                        panelRespuesta.Controls.Add(lblPregunta);

                        respuestaSkeleton.pregunta = pregunta;

                        Respuesta miRespuesta = null;
                        //RESPUESTA
                        if (pregunta.escala.nombre.Equals("Conceptual literal"))
                        {
                            TextBox txtRespuesta = new TextBox();
                            txtRespuesta.ID = "respuesta_" + pregunta.idPregunta.ToString();
                            txtRespuesta.Rows = 5;
                            txtRespuesta.Columns = 75;
                            txtRespuesta.AutoPostBack = false;
                            txtRespuesta.CssClass = "txtMultilinea99";
                            txtRespuesta.TextMode = TextBoxMode.MultiLine;
                            txtRespuesta.Wrap = false;
                            txtRespuesta.MaxLength = 4000;

                            if (ListaRespuestas != null)
                            {
                                miRespuesta = ListaRespuestas.Find(p => p.pregunta.textoPregunta == txtRespuesta.ID);
                                if (miRespuesta != null) txtRespuesta.Text = miRespuesta.respuestaTextual;
                            }
                            txtRespuesta.TextChanged += new EventHandler(this.text_Changed);
                            txtRespuesta.Attributes.Add("onBlur", "GuardarRespuesta(this);");

                            panelRespuesta.Controls.Add(new LiteralControl("<br/>"));
                            panelRespuesta.Controls.Add(txtRespuesta);
                            panelRespuesta.Controls.Add(new LiteralControl("<br/>"));
                        }
                        else
                        {
                            List<ValorEscalaMedicion> lista = new List<ValorEscalaMedicion>();
                            BLValorEscala objBL = new BLValorEscala();
                            EscalaMedicion miEscala = new EscalaMedicion();
                            lista = objBL.GetValoresEscalasMedicion(pregunta.escala);

                            RadioButtonList botonera = new RadioButtonList();
                            botonera.AutoPostBack = true;
                            botonera.ID = "respuesta_" + pregunta.idPregunta.ToString();
                            botonera.SelectedIndexChanged += new EventHandler(botonera_SelectedIndexChanged);
                            foreach (ValorEscalaMedicion item in lista)
                                botonera.Items.Add(new ListItem(item.nombre, item.idValorEscala.ToString()));

                            panelRespuesta.Controls.Add(botonera);
                            cantRespuestasMinimas++;
                        }

                        pn.ContentContainer.Controls.Add(panelRespuesta);
                        pn.ContentContainer.Controls.Add(new LiteralControl("<br/>"));
                    }
                }
                CuestionarioAccordion.Panes.Add(pn);
                ++i;
            }
        }
コード例 #28
0
ファイル: Accordion.cs プロジェクト: pjeconde/CedServicios
        /// <summary>
        /// Create the new control hierarchy of AccordionPanes
        /// (using the DataSource if specificed)
        /// </summary>
        /// <param name="useDataSource">Whether or not we should use the DataSource</param>
        protected virtual void CreateControlHierarchy(bool useDataSource)
        {
            int count = -1;
            IEnumerable dataSource = null;
            List<AccordionPane> itemsArray = new List<AccordionPane>();

            if (!useDataSource)
            {
                object viewCount = ViewState[ItemCountViewStateKey];

                // ViewState must have a non-null value for ItemCount because we check for
                // this in CreateChildControls
                if (viewCount != null)
                {
                    count = (int)viewCount;
                    if (count != -1)
                    {
                        List<object> dummyList = new List<object>(count);
                        for (int i = 0; i < count; i++)
                            dummyList.Add(null);
                        dataSource = dummyList;
                        itemsArray.Capacity = count;
                    }
                }
            }
            else
            {
                dataSource = GetData();
                count = 0;
                ICollection collection = dataSource as ICollection;
                if (collection != null)
                    itemsArray.Capacity = collection.Count;
            }

            if (dataSource != null)
            {
                int index = 0;
                foreach (object dataItem in dataSource)
                {
                    AccordionPane ap = new AccordionPane();
                    Controls.Add(ap);

                    CreateItem(dataItem, index, AccordionItemType.Header, ap.HeaderContainer, HeaderTemplate, useDataSource);
                    CreateItem(dataItem, index, AccordionItemType.Content, ap.ContentContainer, ContentTemplate, useDataSource);

                    itemsArray.Add(ap);

                    count++;
                    index++;
                }
            }

            // If we're binding, save the number of items contained in the repeater for use in round-trips
            if (useDataSource)
                ViewState[ItemCountViewStateKey] = ((dataSource != null) ? count : -1);
        }
コード例 #29
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {

            //VALIDACION PRINCIPAL PARA TODO FORMULARIO
            Session_usuario();
            lblusuario.Text = Session["ssUsuar"].ToString();

            foto2.ImageUrl = "~/Photos/usuarios_sys/"+lblusuario.Text.Trim()+".jpg";

            /*Session["ssEmpresaID"] = "02";
            Session["ssUsuar"] = "gtarazona";
            Session["ssDominioid"] = "60";
            Session["ssModuloid"] = "0320";
            Session["ssPerfil"] = "600320000";*/

            try
            {
                //perfil de modulo
                sys_moduloWebBL moduloBL = new sys_moduloWebBL();
                tb_sys_modulo tb_modulo = new tb_sys_modulo();
                DataTable dtmoduloid = new DataTable();

                string dominioid = Convert.ToString(Session["ssDominioid"]);
                string moduloid = Convert.ToString(Session["ssModuloid"]);

                if (dominioid != "00")
                {
                    if (moduloid == "0000")
                    {
                        modulo_emp.Text = "NINGUNO";

                    }
                    else
                    {
                        dtmoduloid = moduloBL.GetOne(Session["ssEmpresaID"].ToString(), dominioid, moduloid).Tables[0];
                        modulo_emp.Text = fungen.RemoveAccentsWithRegEx(dtmoduloid.Rows[0]["moduloname"].ToString());
                    }
                }
                else
                {
                    modulo_emp.Text = "NINGUNO";
                }

                //perfil de usuario
                usuariosWebBL usuariosBL = new usuariosWebBL();
                tb_usuarios tb_usuarios = new tb_usuarios();
                DataTable dtMenuItems = new DataTable();
                DataTable dtMenuItems02 = new DataTable();
                string COD_USU = Convert.ToString(Session["ssUsuar"]);

                dtMenuItems = usuariosBL.GenerarMenuXperfil(Session["ssEmpresaID"].ToString(), COD_USU, Session["ssPerfil"].ToString()).Tables[0];
                dtMenuItems02 = usuariosBL.GenerarMenuXperfil_child(Session["ssEmpresaID"].ToString(), COD_USU, Session["ssPerfil"].ToString()).Tables[0];

                AccordionPane p;
                Panel pnlHeader;
                TreeView tree;
                TreeNode mnuMenuItem;
                Int32 i = 0;
                String xgrupo = "", xpadid = "";

                foreach (DataRow drMenuItem in dtMenuItems.Rows)
                {
                    i++;
                    p = new AccordionPane();
                    p.ID = "Pane" + i;

                    if (drMenuItem["posic"].ToString() == "0")
                    {
                        pnlHeader = new Panel();
                        HyperLink hlHeader = new HyperLink();
                        hlHeader.NavigateUrl = "#";
                        hlHeader.Text = drMenuItem["descr"].ToString();
                        pnlHeader.Controls.Add(hlHeader);
                        p.HeaderContainer.Controls.Add(pnlHeader);
                        xgrupo = drMenuItem["grupo"].ToString();
                        xpadid = drMenuItem["padid"].ToString();
                    }
                    else
                    {
                        xgrupo = "";
                    }

                    tree = new TreeView();
                    tree.ID = "tree" + i;
                    foreach (DataRow drMenuItem02 in dtMenuItems02.Rows)
                    {
                        string aaa = drMenuItem02["padid"].ToString();
                        string aa = drMenuItem02["grupo"].ToString();
                        if (drMenuItem02["grupo"].ToString() == xgrupo && drMenuItem02["padid"].ToString() == xpadid)
                        {
                            mnuMenuItem = new TreeNode();
                            mnuMenuItem.Value = drMenuItem02["menid"].ToString();
                            mnuMenuItem.Text = drMenuItem02["descr"].ToString();
                            mnuMenuItem.ImageUrl = drMenuItem02["Icono"].ToString();
                            mnuMenuItem.Target = "frameMain";

                            if (drMenuItem02["nivelacc"].ToString().Trim().Length == 0)
                            {
                                mnuMenuItem.NavigateUrl = drMenuItem02["pgurl"].ToString();
                            }
                            else
                            {
                                mnuMenuItem.NavigateUrl = drMenuItem02["pgurl"].ToString() + "?idnivel=" + drMenuItem02["nivelacc"].ToString();
                            }

                            tree.Nodes.Add(mnuMenuItem);
                            //TreeViewImageSet imagen = new TreeViewImageSet();
                            //imagen = TreeViewImageSet.XPFileExplorer;
                            //tree.ImageSet = imagen;
                            tree.RootNodeStyle.CssClass = "roottreview";
                            tree.RootNodeStyle.ImageUrl = "lib/img/folder.gif";
                            tree.ParentNodeStyle.CssClass = "roottreview";
                            tree.ParentNodeStyle.ImageUrl = "lib/img/folder.gif";
                            tree.NodeStyle.CssClass = "nodetreview";
                            tree.NodeStyle.ImageUrl = "lib/img/documento.gif";

                            //hacemos un llamado al metodo recursivo encargado de generar el árbol del menú.
                            AddMenuItem2(ref mnuMenuItem, dtMenuItems02, xgrupo);
                        }
                    }
                    if (drMenuItem["posic"].ToString() == "0")
                    {
                        p.ContentContainer.Controls.Add(tree);
                        p.ContentCssClass = "accordioncontent";
                        accmenuperfil.Panes.Add(p);

                        accmenuperfil.Panes.Add(p);
                    }
                }
            }
            catch
            {
                //Response.Redirect("~/Login02.aspx");
            }
            try
            {
                get_TipoAlmac_local(Session["ssDominioid"].ToString(), Session["ssModuloid"].ToString());
            }
            catch
            {
                //Response.Redirect("~/Login01.aspx");
                Response.Redirect("~/Login.aspx",false);
            }
        }
    }