Hi,
I'm currently having the problem, that my "add new record" button isn't showing in my detailgrid..
Even so, my grid does not show the expandbutton, to open the detailgrid.
I'm currently aware that there are no records to retrieve from the database, but however it must show the text "No items to display"
I included a screenshot for more information.
This is the code:
I'm currently having the problem, that my "add new record" button isn't showing in my detailgrid..
Even so, my grid does not show the expandbutton, to open the detailgrid.
I'm currently aware that there are no records to retrieve from the database, but however it must show the text "No items to display"
I included a screenshot for more information.
This is the code:
public void Page_Load(object sender, EventArgs e) { // Get Total ProcessTemplates SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MSCBE.DashboardConnectionString"].ConnectionString); SqlCommand cmd = new SqlCommand("SELECT COUNT(ProcessTemplate_id) AS total FROM ProcessTemplate", conn); conn.Open(); int intTotalProcessTemplates = Convert.ToInt32(cmd.ExecuteScalar()); conn.Close(); // Create grids RadGrid[] GridName = new RadGrid[intTotalProcessTemplates]; for (int i = 0; i < intTotalProcessTemplates; ++i) { // Create mastertable GridName[i] = new RadGrid(); GridName[i].DataSource = GetDataTables.GetDataTable("SELECT * FROM ProcessTemplate WHERE ProcessTemplate_id = " + (i + 1)); GridName[i].MasterTableView.DataKeyNames = new string[] { "ProcessTemplate_id" }; GridName[i].Skin = "Black"; GridName[i].AutoGenerateColumns = false; GridName[i].AllowPaging = true; GridName[i].ShowStatusBar = true; // Columns create GridName[i].MasterTableView.Columns.Add(CreateGridColumn("Process name", "Name", 10.0)); GridName[i].MasterTableView.Columns.Add(CreateGridColumn("Process description", "Description", 80.0)); GridName[i].MasterTableView.Columns.Add(CreateGridColumn("Parent", "Parent", 10.0)); // Create detail table GridTableView tableViewStartProcesses = new GridTableView(GridName[i]); tableViewStartProcesses.Name = "DetailTable_" + i; tableViewStartProcesses.DataKeyNames = new string[] { "Process_id" }; tableViewStartProcesses.AutoGenerateColumns = false; tableViewStartProcesses.AllowPaging = true; tableViewStartProcesses.ShowFooter = true; tableViewStartProcesses.ShowHeadersWhenNoRecords = true; tableViewStartProcesses.CommandItemDisplay = GridCommandItemDisplay.Top; // Reset Counter //Count[i] = new int(); int counter = 0; CountItems countitem = new CountItems(); countitem.id = i; // Fix result from stored proc: GetAllProcessesAndSteps_SP DataSet _dataset = BLProcessesAndSteps.GetAllProcessesAndSteps((i + 1)); if (_dataset.Tables.Count > 0) { var query = from r in _dataset.Tables[0].AsEnumerable() where r.Field<decimal>("templateid") == (i + 1) // DO NOT REMOVE FROM STORED PROC select r; // Get total columns int TotalColumns = query.AsDataView().Table.Columns.Count; GridBoundColumn[] gbcColumnName = new GridBoundColumn[TotalColumns]; // Loop trough header items for (int j = 0; j < TotalColumns; ++j) { // Create detailcolumns gbcColumnName[j] = new GridBoundColumn(); gbcColumnName[j].ReadOnly = true; string strData = query.AsDataView().Table.Columns[j].ToString(); if (strData == "Process_id" || strData == "templateId" || strData == "ProcessName") { gbcColumnName[j].Visible = false; gbcColumnName[j].ReadOnly = true; } string strQuery = "SELECT DISTINCT(CriteriaType.Name), CriteriaType.CriteriaType_id, Process.ProcessTemplate_id FROM CriteriaType INNER JOIN CriteriaValue ON CriteriaType.CriteriaType_id = CriteriaValue.CriteriaType_id INNER JOIN Process ON CriteriaValue.Process_id = Process.Process_id WHERE Process.ProcessTemplate_id = " + (i + 1); DataTable dtCriteriaTypes = GetDataTables.GetDataTable(strQuery); string[] strValues = new string[dtCriteriaTypes.AsDataView().Table.Rows.Count]; for (int k = 0; k < dtCriteriaTypes.AsDataView().Table.Rows.Count; ++k) { strValues[k] = dtCriteriaTypes.AsDataView().Table.Rows[k]["Name"].ToString(); if (strData == strValues[k]) { gbcColumnName[j].ReadOnly = false ; counter++; } } countitem.count=counter; gbcColumnName[j].HeaderText = strData; gbcColumnName[j].DataField = strData; // Add detailcolumns tableViewStartProcesses.Columns.Add(gbcColumnName[j]); } Count.Add(countitem); // Add Details to table GridName[i].MasterTableView.DetailTables.Add(tableViewStartProcesses); // Rebind tableViewStartProcesses.DataSource = query.AsDataView(); } // Add to placeholder this.StartProcessPlaceHolder.Controls.Add(GridName[i]); // Events GridName[i].InsertCommand += new GridCommandEventHandler(OverviewProcess_InsertCommand); }