This is a migrated thread and some comments may be shown as answers.

Problems with DetailTable

3 Answers 90 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Carlos Rodriguez
Top achievements
Rank 1
Carlos Rodriguez asked on 01 Apr 2011, 07:41 PM
I am adding a table of detail in each row that appears, add it to programming. The problem is, when you expand the line, you see all the tables in detail all items.
'What may be missing?

this is my code for add a table of detail in each row:

DataTable datTabDatosDetalle = new DataTable();
                    if (ViewState["OrdCompraProdDetallesSub" + IdOrdenCompra + Skucode] == null)
                    {
                        datTabDatosDetalle = CCSMovimientoProductos.BuscarProdDetOrdenCompra_CEDIS(IdOrdenCompra, Skucode).Tables[0];
                        ViewState.Add("OrdCompraProdDetallesSub" + IdOrdenCompra + Skucode, datTabDatosDetalle);
                    }
                    else
                        datTabDatosDetalle = (DataTable)ViewState["OrdCompraProdDetallesSub" + IdOrdenCompra + Skucode];
  
                    Telerik.Web.UI.GridTableView detailTable = new Telerik.Web.UI.GridTableView(radGriOrdComDetalles);
                    radGriOrdComDetalles.MasterTableView.DetailTables.Add(detailTable);
  
                    detailTable.Name = "tabDetail" + IdOrdenCompra + Skucode;
                    detailTable.DataKeyNames = new string[] { "Id", "prodSkucode" };
                    detailTable.EnableViewState = true;
                    detailTable.NoDetailRecordsText = "Sin registros.";
                    detailTable.Caption = "Detalle del producto Sku " + Skucode;
                    detailTable.EditMode = Telerik.Web.UI.GridEditMode.InPlace;
  
                    foreach (DataColumn dc in datTabDatosDetalle.Columns)
                    {
                        Telerik.Web.UI.GridBoundColumn campo = new Telerik.Web.UI.GridBoundColumn();
                        detailTable.Columns.Add(campo);
                        campo.UniqueName = "col" + dc.ColumnName;
                        campo.HeaderText = "[ " + dc.ColumnName + " ]";
                        campo.HeaderStyle.Font.Bold = true;
                        campo.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
                        campo.DataField = dc.ColumnName;
  
                        if (dc.ColumnName == "Id")
                            campo.Visible = false;
                        if (dc.ColumnName == "prodSkucode")
                            campo.Visible = false;
                        if (dc.ColumnName == "Talla")
                            campo.ReadOnly = true;
                    }
  
                    Telerik.Web.UI.GridEditCommandColumn campoEdit = new Telerik.Web.UI.GridEditCommandColumn();
                    campoEdit.UniqueName = "colEdit";
                    campoEdit.ButtonType = Telerik.Web.UI.GridButtonColumnType.ImageButton;
                    campoEdit.EditText = "Editar";
                    campoEdit.UpdateText = "Actualizar";
                    campoEdit.CancelText = "Cancelar";
                    detailTable.Columns.Add(campoEdit);
                    detailTable.DataSource = datTabDatosDetalle;
  
                    detailTable.Rebind();
                    radGriOrdComDetalles.Rebind();

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 04 Apr 2011, 09:02 AM
Hello Carlos,

You can use the DetailTableDataBind event to bind each detail table-view. The following demo shows how to achieve this.
Grid / Programmatic Binding

Thanks,
Princy.
0
Carlos Rodriguez
Top achievements
Rank 1
answered on 04 Apr 2011, 03:25 PM
Hi Princy!

Thanks, but I have a problem. The structure of the detail table changes, you can have from 3 to "N"columns.

The procedure for constructing the structure is done, the problem is that I displayed all TableDetial of all Items, but only fill TableDetail data where it belongs.

This is the link for the image (I can not upload it to this site will not work)
http://www.subirimagenes.com/otros-image-6209031.html
0
Carlos Rodriguez
Top achievements
Rank 1
answered on 04 Apr 2011, 07:18 PM
The code I've shown before I added the following lines of code:
http://www.subirimagenes.com/otros-code-6209982.html

to run the application, I get the following error when deploying the TableDetail:
http://www.subirimagenes.com/otros-imageerror-6209976.html

Any ideas?
Tags
Grid
Asked by
Carlos Rodriguez
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Carlos Rodriguez
Top achievements
Rank 1
Share this question
or