public void LoadTab(int userID, int sensitivity) { dsTabNames = menugenerator.GetTabNames(interfaceID, userID, sensitivity); if (dsTabNames.Tables[0].Rows.Count > 0) { TableRow templatesRow = new TableRow(); templatesRow.CssClass = "TopMenu"; templatesRow.Width = Unit.Percentage(100); TableCell templateCell = new TableCell(); int numberOfTemplates = dsTabNames.Tables[0].Rows.Count; int numberOfColumns = 6; for (int i = 0; i < numberOfTemplates; i++) { templateCell = new TableCell(); templateCell.VerticalAlign = VerticalAlign.Middle; templateCell.HorizontalAlign = HorizontalAlign.Left; templateCell.ID = "td" + i; //templateCell.Width = Unit.Percentage(15); templateCell.Attributes.Add("onmouseover", "this.className='TopMenuMo'"); templateCell.Attributes.Add("onmouseout", "CheckMenuCicked(this)"); templateCell.CssClass = "TopMenu"; Label lblMenuTabName = new Label(); lblMenuTabName.ID = "lbl" + i; lblMenuTabName.Text = dsTabNames.Tables[0].Rows[i]["Name"].ToString(); lblMenuTabName.ToolTip = dsTabNames.Tables[0].Rows[i]["Name"].ToString(); //lblMenuTabName.Attributes.Add("onclick", "ChangeStatus(this,'" + dsTabNames.Tables[0].Rows[i]["TabID"].ToString() + "')"); templateCell.Attributes.Add("onclick", "ChangeStatus(this,'" + dsTabNames.Tables[0].Rows[i]["TabID"].ToString() + "')"); templateCell.Controls.Add(lblMenuTabName); templatesRow.Cells.Add(templateCell); if (((i + 1) % numberOfColumns) == 0) { tblTemplates.Rows.Add(templatesRow); templatesRow = new TableRow(); templatesRow.Width = Unit.Percentage(100); } } tblTemplates.Rows.Add(templatesRow); } if (dsTabNames.Tables[0].Rows.Count <= 6) { hidTabRows.Value = "Single"; Response.Write("<script>"); Response.Write("top.Frame1.rows='105,*,29';"); Response.Write("</script>"); } else { hidTabRows.Value = ""; } }
/// <summary> /// Fill TreeView Items /// </summary> private void FillTreeView() { try { // // Calling a function to get Tabs to be displayed for this User // DataSet dsTabNames = menuGenerator.GetTabNames(Convert.ToInt32(PFC.Intranet.Global.IntranetInterfaceID), userID, sensitivity); // Dividing the menu items int iTotalRows = dsTabNames.Tables[0].Rows.Count; int iFirstDLRow = iTotalRows / 3; int iSecondDLRow = iFirstDLRow + iFirstDLRow; DataTable dtTabName = new DataTable(); DataTable dtTabName1 = new DataTable(); DataTable dtTabName2 = new DataTable(); dtTabName.Columns.Add("Name"); dtTabName.Columns.Add("TabID"); dtTabName.Columns.Add("Mouseoutcolour"); dtTabName.Columns.Add("Mouseovercolour"); dtTabName1.Columns.Add("Name"); dtTabName1.Columns.Add("TabID"); dtTabName1.Columns.Add("Mouseoutcolour"); dtTabName1.Columns.Add("Mouseovercolour"); dtTabName2.Columns.Add("Name"); dtTabName2.Columns.Add("TabID"); dtTabName2.Columns.Add("Mouseoutcolour"); dtTabName2.Columns.Add("Mouseovercolour"); for (int i = 0; i < dsTabNames.Tables[0].Rows.Count; i++) { if (i < iFirstDLRow) { DataRow drTable = dtTabName.NewRow(); drTable[0] = dsTabNames.Tables[0].Rows[i]["Name"].ToString(); drTable[1] = dsTabNames.Tables[0].Rows[i]["TabID"].ToString(); drTable[2] = dsTabNames.Tables[0].Rows[i]["Mouseoutcolour"].ToString(); drTable[3] = dsTabNames.Tables[0].Rows[i]["Mouseovercolour"].ToString(); dtTabName.Rows.Add(drTable); } else if (i < iSecondDLRow) { DataRow drTable = dtTabName1.NewRow(); drTable[0] = dsTabNames.Tables[0].Rows[i]["Name"].ToString(); drTable[1] = dsTabNames.Tables[0].Rows[i]["TabID"].ToString(); drTable[2] = dsTabNames.Tables[0].Rows[i]["Mouseoutcolour"].ToString(); drTable[3] = dsTabNames.Tables[0].Rows[i]["Mouseovercolour"].ToString(); dtTabName1.Rows.Add(drTable); } else { DataRow drTable = dtTabName2.NewRow(); drTable[0] = dsTabNames.Tables[0].Rows[i]["Name"].ToString(); drTable[1] = dsTabNames.Tables[0].Rows[i]["TabID"].ToString(); drTable[2] = dsTabNames.Tables[0].Rows[i]["Mouseoutcolour"].ToString(); drTable[3] = dsTabNames.Tables[0].Rows[i]["Mouseovercolour"].ToString(); dtTabName2.Rows.Add(drTable); } } dlMenuTab.DataSource = dtTabName; dlMenuTab.DataBind(); dlMenuTab1.DataSource = dtTabName1; dlMenuTab1.DataBind(); dlMenuTab2.DataSource = dtTabName2; dlMenuTab2.DataBind(); } catch (Exception ex) { } }