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

[Solved] RadGrid by code - HeaderText when the grid have detail

1 Answer 108 Views
Grid
This is a migrated thread and some comments may be shown as answers.
maria
Top achievements
Rank 1
maria asked on 27 Oct 2009, 09:18 PM
Hi,
I have a RadGrid  it was created in design time and also this grid have a detail. But the problem is when I want to see the detail, the HeaderText of the master table is not visible.

How can I fix it?
 private void GenerarGrilla() 
    { 
        List<string> dataKeyNamesList = new List<string>(); 
        radgridResultados.AutoGenerateColumns = false
        radgridResultados.Visible = true
        foreach (ConfiguracionUI.Campo campo in form.Grilla.Campos) 
        { 
            GridBoundColumn boundColumn; 
            boundColumn = new GridBoundColumn(); 
            boundColumn.DataField = campo.Key; 
            boundColumn.HeaderText = campo.Name; 
            boundColumn.Visible = campo.Visible; 
            radgridResultados.MasterTableView.Columns.Add(boundColumn); 
            if (campo.IsdataKey == true)              
                dataKeyNamesList.Add(campo.Key); 
        } 
 
        string[] dataKeyNames = new string[dataKeyNamesList.Count]; 
        dataKeyNamesList.CopyTo(dataKeyNames); 
        radgridResultados.MasterTableView.DataKeyNames = dataKeyNames
        radgridResultados.AllowSorting = false
        radgridResultados.AutoGenerateColumns = false
 
    } 
 
private void GenerarDetalle(GridTableView tableViewOrders) 
    {   
        radgridResultados.MasterTableView.DetailTables.Add(tableViewOrders); 
 
        foreach (ConfiguracionUI.Campo campoDetalle in form.Grilla.Detalle) 
        { 
            GridBoundColumn boundColumn; 
            GridHyperLinkColumn linkImagen; 
            if (campoDetalle.ColumnType != null) 
            { 
                linkImagen = new GridHyperLinkColumn(); 
                //linkImagen.DataNavigateUrlFields = campoDetalle.Key; 
                linkImagen.HeaderText = campoDetalle.Name; 
                linkImagen.Text = "Ver Imagen"
                linkImagen.NavigateUrl = "javascript:ShowMessage('imagen.aspx?&amp;C={0}&amp;R={1}&amp;P={2}&amp;I=True')";         
                tableViewOrders.Columns.Add(linkImagen); 
            } 
            else 
            { 
                boundColumn = new GridBoundColumn(); 
                boundColumn.DataField = campoDetalle.Key; 
                boundColumn.HeaderText = campoDetalle.Name; 
                tableViewOrders.Columns.Add(boundColumn); 
            } 
        } 
 
    } 

1 Answer, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 30 Oct 2009, 09:23 AM
Hello maria,

The sample code you provided does not indicate anything wrong with the header of the MasterTableView. Could you, please, give us some more details and/or post some markup from RadGrid's definition that we can examine.

Greetings,
Veli
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
maria
Top achievements
Rank 1
Answers by
Veli
Telerik team
Share this question
or