private void BindDdlCubeFolder() { List <CubeFolder> folderList = CubeFolderDB.GetAllFolderList(); ddlCubeFolder.Items.Clear(); foreach (CubeFolder folder in folderList) { ListItem item = new ListItem(folder.Name, folder.ID); ddlCubeFolder.Items.Add(item); } ddlCubeFolder.Items.Insert(0, new ListItem("-------全部-------", "")); ddlCubeFolder.Items.Insert(1, new ListItem("------未分类------", "-1")); }
private void InitSelectCubeFolder() { List <CubeFolder> folderList = CubeFolderDB.GetAllFolderList(); selectCubeFolder.Items.Add(new ListItem("----全部分类----", "")); foreach (CubeFolder c in folderList) { ListItem item = new ListItem(); item.Text = c.Name; item.Value = c.ID.ToString(); selectCubeFolder.Items.Add(item); } if (folderList.Count > 0) { selectCubeFolder.SelectedIndex = 1; } }
private void BindGridCube(string folderID) { List <Cube> cubeList = CubeDB.GetCubeListByFolder(folderID); gridCube.DataSource = cubeList; gridCube.DataBind(); List <CubeFolder> folderList = CubeFolderDB.GetAllFolderList(); foreach (GridViewRow row in gridCube.Rows) { DropDownList ddl = row.Cells[1].FindControl("ddlCubeFolderInGrid") as DropDownList; BindDdlCubeFolderInGrid(ddl, folderList, cubeList.Find(p => p.ID.ToString() == gridCube.DataKeys[row.RowIndex].Value.ToString()).CubeFolder.ID); if (row.RowIndex != gridCube.EditIndex) { ddl.Enabled = false; } } }
protected void btnAddCube_Click(object sender, EventArgs e) { tableCubeAdd.Visible = true; List <CubeFolder> folderList = CubeFolderDB.GetAllFolderList(); ddlCubeToAddFoler.Items.Clear(); foreach (CubeFolder folder in folderList) { ListItem item = new ListItem(folder.Name, folder.ID); ddlCubeToAddFoler.Items.Add(item); } ddlCubeToAddFoler.Items.Insert(0, new ListItem("---------未分类---------", "-1")); foreach (ListItem item in ddlCubeToAddFoler.Items) { if (item.Value == ddlCubeFolder.SelectedValue) { item.Selected = true; break; } } lblCubeAddMsg.Text = ""; txtCubeName.Text = ""; txtExplain.Text = ""; }