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

[Solved] Problems with width of DetailTables

3 Answers 246 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Fabian Raul Jofre
Top achievements
Rank 2
Fabian Raul Jofre asked on 14 May 2009, 08:23 PM
I am having problems with the width of the grid.

If I have a Radgrid with detailstable, when i expand the detailsTable, everything is ok, but, for example.
If i expand the second and the others records, always expand, but not expand with 100% of width the details table.

This is the code of RadGrid.

<

 

telerik:RadGrid ShowGroupPanel="false" AutoGenerateColumns="false" ID="RadGrid1" AllowFilteringByColumn="False" AllowSorting="true" ShowFooter="True" runat="server" AllowPaging="false" Skin="MyCustomSkin" EnableEmbeddedSkins="false" OnSortCommand="RadGrid1_SortCommand" OnItemDataBound="RadGrid1_ItemDataBound" OnDetailTableDataBind="RadGrid1_DetailTableDataBind" OnColumnCreated="RadGrid1_ColumnCreated" Width="100%">

 

 

 

 

<ExportSettings OpenInNewWindow="true" ExportOnlyData="true">

 

 

 

 

<Excel Format="Html" FileExtension="XLS"/>

 

 

 

 

<Pdf PaperSize="Legal" />

 

 

 

 

</ExportSettings>

 

 

 

 

<ClientSettings>

 

 

 

 

<Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="true">

 

 

 

 

</Scrolling>

 

 

 

 

<ClientEvents OnGridCreated="GridCreated" />

 

 

 

 

</ClientSettings>

 

 

 

 

<MasterTableView DataKeyNames="id_grupo,id_tipogrupo">

 

 

 

 

<DetailTables>

 

 

 

<telerik:GridTableView DataKeyNames="salto,nroserie" Width="100%">

 

 

 

<Columns>

 

 

 

<telerik:GridBoundColumn DataField="UID" HeaderText="UID" SortExpression="UID" UniqueName="UID" />

 

 

 

<telerik:GridBoundColumn DataField="Juego" HeaderText="Juego" SortExpression="Juego" UniqueName="Juego" />

 

 

 

<telerik:GridBoundColumn DataField="Fabricante" HeaderText="Fabricante" SortExpression="Fabricante" UniqueName="Fabricante" />

 

 

<telerik:GridBoundColumn DataField="Tipo" HeaderText="Tipo" SortExpression="Tipo" UniqueName="Tipo" />

 

 

<telerik:GridBoundColumn DataField="fechadesde" HeaderText="Desde" SortExpression="fechadesde" UniqueName="fechadesde" DataFormatString="{0:dd/MM/yyyy hh:mm:ss}" />

 

 

 

<telerik:GridBoundColumn DataField="fechahasta" HeaderText="Hasta" SortExpression="fechahasta" UniqueName="fechahasta" DataFormatString="{0:dd/MM/yyyy hh:mm:ss}" />

 

 

 

<telerik:GridBoundColumn DataField="dias" HeaderText="Días" SortExpression="dias" UniqueName="dias" />

 

 

 

<telerik:GridCalculatedColumn HeaderText="% Dev" DataType="System.Decimal" UniqueName="devolucion" DataFields="apuesta,ganancia" Expression="IIF({0}>0,(100)-({1}/{0}*100),0.00)" DataFormatString="{0:##0.00}" Aggregate="Avg" />

 

 

 

<telerik:GridBoundColumn DataField="apuesta" HeaderText="Apuesta" SortExpression="apuesta" UniqueName="apuesta" DataFormatString="{0:###,###,##0.00}" EmptyDataText="0,00" Aggregate="Sum" />

 

 

 

<telerik:GridBoundColumn DataField="ganancia" HeaderText="Ganancia" SortExpression="ganancia" UniqueName="ganancia" DataFormatString="{0:###,###,##0.00}" EmptyDataText="0,00" Aggregate="Sum"/>

 

 

 

<telerik:GridBoundColumn DataField="partidas" HeaderText="Partidas" SortExpression="partidas" UniqueName="partidas" EmptyDataText="0" DataFormatString="{0:######}" Aggregate="Sum" />

 

 

 

<telerik:GridCalculatedColumn HeaderText="Prm.Aptas" DataType="System.Decimal" DataFields="apuesta,dias" Expression="IIF({0}>0,{0}/{1},0.00)" DataFormatString="{0:###,###,##0.00}" Aggregate="Avg" UniqueName="promApuestas" />

 

 

 

<telerik:GridCalculatedColumn HeaderText="Prm.Gcia" DataType="System.Decimal" DataFields="ganancia,dias" Expression="IIF({0}>0,{0}/{1},0.00)" DataFormatString="{0:###,###,##0.00}" Aggregate="Avg" UniqueName="promGcia" />

 

 

 

<telerik:GridBoundColumn DataField="promediopartidas" HeaderText="Prm.Ptdas" SortExpression="promediopartidas" DataFormatString="{0:###,###,##0.00}" EmptyDataText="0,00" Aggregate="Avg" UniqueName="promPartidas" />

 

 

 

</Columns>

 

 

 

<GroupByExpressions>

 

 

 

<telerik:GridGroupByExpression>

 

 

 

<SelectFields>

 

 

 

<telerik:GridGroupByField FieldAlias="Fabricante" FieldName="Fabricante"></telerik:GridGroupByField>

 

 

 

</SelectFields>

 

 

 

<GroupByFields>

 

 

 

<telerik:GridGroupByField FieldName="Fabricante"></telerik:GridGroupByField>

 

 

 

</GroupByFields>

 

 

 

</telerik:GridGroupByExpression>

 

 

 

</GroupByExpressions>

 

 

 

</telerik:GridTableView>

 

 

 

</DetailTables>

 

 

 

<Columns>

 

 

 

<telerik:GridBoundColumn DataField="Grupo" HeaderText="Grupo" SortExpression="Grupo" UniqueName="Grupo"></telerik:GridBoundColumn>

 

 

 

</Columns>

 

 

 

</MasterTableView>

 

 

 

</telerik:RadGrid>


And this is the example:
First Picture

Second Picture

Third Picture

Thank´s if you can Help me.

 

 

 

 

 

 

 

3 Answers, 1 is accepted

Sort by
0
Accepted
Sebastian
Telerik team
answered on 18 May 2009, 01:46 PM
Hello Fabian,

Can you please check whether setting Width = "100%" and TableLayout="Fixed" for the MasterTableView and detail table in the grid alleviates the abnormality? Thus all tables in the control should be stretched and rendered as expected.

Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Fabian Raul Jofre
Top achievements
Rank 2
answered on 18 May 2009, 02:04 PM

Dear Telerik.

 

I tried with checked settings

<

 

MasterTableView DataKeyNames="id_grupo,id_tipogrupo" Width="100%" TableLayout="Fixed">

 

 

 

 

<DetailTables>

 

 

 

 

<telerik:GridTableView DataKeyNames="salto,nroserie" Width="100%" TableLayout="Fixed">
But the result are the same.

There is something that i didn´t say.

In the code behind when i do the databind of detail table depend of the check´s of the apsx. i am showing or not some columns.
For me here is the problem. I think that, becouse if i checked all option in true, there is no problems, beacouse all columns will be show. but if some check is not checked, here is the problem, becouse some columns are not showed. So the details table not expand at 100%.
I can´t found a solucion.
I tried with properties "Visible and Display, but in both case doesn´t work."

Here is the codebehind

 

protected

 

void RadGrid1_DetailTableDataBind(object source, Telerik.Web.UI.GridDetailTableDataBindEventArgs e)

 

{

 

 

 

 

e.DataSource = Session[

 

 

"Datos"];

 

 

 

 

if(!chkCampos.Items[0].Selected)

 

e.Columns[7].Visible =

 

 

false;

 

 

 

 

else

 

 

 

 

 

 

e.Columns[7].Visible =

 

 

true;

 

 

 

 

if(!chkCampos.Items[1].Selected)

 

e.Columns[8].Visible =

 

 

false;

 

 

 

 

else

 

 

 

 

 

 

e.Columns[8].Visible =

 

 

true;

 

 

 

 

if(!chkCampos.Items[2].Selected)

 

e.Columns[9].Visible =

 

 

false;

 

 

 

 

else

 

 

 

 

 

 

e.Columns[9].Visible =

 

 

true;

 

 

 

 

if(!chkCampos.Items[3].Selected)

 

{

e.Columns[10].Visible =

 

 

false;

 

e.Columns[11].Visible =

 

 

false;

 

e.Columns[12].Visible =

 

 

false;

 

}

 

 

 

else

 

 

 

 

 

 

{

e.Columns[10].Visible =

 

 

true;

 

e.Columns[11].Visible =

 

 

true;

 

e.Columns[12].Visible =

 

 

true;

 

}

 

 

 

}

 

Image Wrong:

http://www.overpic.net/viewer.php?file=xywp1d6hshs2kqi5qttga.jpg

Image ok
http://www.overpic.net/viewer.php?file=xab22gfv81d9wo1xxe0l.jpg

0
Sebastian
Telerik team
answered on 18 May 2009, 02:32 PM
Hello Fabian,

For your scenario you may need to recalculate the widths of the columns to ensure that those which remain visible will fill the entire available space or use explicitly HeaderStyle -> Width setting globally through the GridTableView tag to stretch them as requested.

Additionally, how to apply dynamic settings for declarative columns you can see from the bottom section of this help topic.

If this does not help, I will appreciate if you provide a live url where the discrepancy can be observed. Thus I will do my best to advice you further. You may also use IE developer toolbar or FireBug to inspect the rendered html of the page as this can help us determine the cause of the abnormality and eliminate it.

Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Fabian Raul Jofre
Top achievements
Rank 2
Answers by
Sebastian
Telerik team
Fabian Raul Jofre
Top achievements
Rank 2
Share this question
or