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

Columns Alignement on AutogeneratedColumns

2 Answers 112 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ricardo
Top achievements
Rank 1
Ricardo asked on 23 Aug 2011, 04:32 PM
Hello Experts,

i'm having a problem while combining a RadPanelBar and 2 RadGrids...The problem is that i can't align all columns to the left or right....
I'm using the autogenerate columns property, data are being bind from 2 mapped stored procedures.

My ASPX code is:
<telerik:RadPanelBar runat="server" ID="RadPanelBar1" Width="100%" Skin="Black">
    <Items>
        <telerik:RadPanelItem>
            <ItemTemplate>
            </ItemTemplate>
        </telerik:RadPanelItem>
        <telerik:RadPanelItem Text="Unassigned" Expanded="false">
            <ContentTemplate>
                <div id="unassigned">
                    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                        <AjaxSettings>
                            <telerik:AjaxSetting AjaxControlID="RadGrid4">
                                <UpdatedControls>
                                    <telerik:AjaxUpdatedControl ControlID="RadGrid4" LoadingPanelID="RadAjaxLoadingPanel1" />
                                </UpdatedControls>
                            </telerik:AjaxSetting>
                            <telerik:AjaxSetting AjaxControlID="RadGrid2">
                                <UpdatedControls>
                                    <telerik:AjaxUpdatedControl ControlID="RadGrid2" LoadingPanelID="RadAjaxLoadingPanel1" />
                                </UpdatedControls>
                            </telerik:AjaxSetting>
                        </AjaxSettings>
                    </telerik:RadAjaxManager>
                    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Black" />
                    <br />
                    <table>
                        <tr>
                            <td style="width: 271px">
                            </td>
                            <td>
                                <telerik:RadGrid ID="RadGrid3" runat="server" Skin="Black" CellSpacing="0" GridLines="None"
                                    Width="250px" Height="300px" AutoGenerateColumns="False" HorizontalAlign="Left" >
                                    <ClientSettings>
                                        <Scrolling AllowScroll="True" UseStaticHeaders="False" />
                                    </ClientSettings>
                                    <MasterTableView HorizontalAlign="Left">
                                        <Columns>
                                            <telerik:GridBoundColumn DataField="Unassigned" HeaderText="Unassigned Users" UniqueName="Unassigned"
                                                SortExpression="Unassigned" HeaderStyle-HorizontalAlign="Center">
                                            </telerik:GridBoundColumn>
                                        </Columns>
                                    </MasterTableView>
                                    <FilterMenu EnableImageSprites="False">
                                    </FilterMenu>
                                </telerik:RadGrid>
                            </td>
                            <td style="width: 60px">
                            </td>
                            <td>
                                <telerik:RadGrid ID="RadGrid4" runat="server" Skin="Black" CellSpacing="0" HorizontalAlign="Left" GridLines="None"
                                    Width="350px" Height="300px" AllowSorting="True">
                                    <ClientSettings>
                                        <Scrolling AllowScroll="True" UseStaticHeaders="False" />
                                    </ClientSettings>
                                    <MasterTableView HorizontalAlign="Left">
                                    </MasterTableView>
                                    <FilterMenu EnableImageSprites="False">
                                    </FilterMenu>
                                    <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Windows7">
                                    </HeaderContextMenu>
                                </telerik:RadGrid>
                            </td>
                        </tr>
                    </table>
                    <br />
                </div>
            </ContentTemplate>
        </telerik:RadPanelItem>
    </Items>
</telerik:RadPanelBar>

On my code behind i have:
EscalonamentoFacturasEntities objectContx = new EscalonamentoFacturasEntities();
             
 RadGrid4.DataSource = objectContx.UnassignedInvoicesResume();
            //RadGrid4.HorizontalAlign;
            RadGrid4.DataBind();
  
  
RadGrid3.DataSource = this.Unassigned;
                RadGrid3.DataBind();

2 Answers, 1 is accepted

Sort by
0
Ricardo
Top achievements
Rank 1
answered on 24 Aug 2011, 12:11 PM
I found that when i use those two RadGrids outside of the RadPanel, the allignement by default is left...(What i want), but when i put those Grids inside the RadPanel then they become with the allignement I show in the attached file.....

I have already tried to use a prerender event like that :
protected void RadGrid3_PreRender(object sender, EventArgs e)
        {
  
            RadGrid3.MasterTableView.HorizontalAlign = HorizontalAlign.Left;
  
  
  
        }
but nothings happen....
0
Accepted
Pavlina
Telerik team
answered on 25 Aug 2011, 03:03 PM
Hello Ricardo,

Note that you must rebind the grid by calling its Rebind() method to reflect the changes. You can refer to the following help article for more information:
http://www.telerik.com/help/aspnet-ajax/grid-using-columns.html (Customizing columns programmatically section)

All the best,
Pavlina
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
Grid
Asked by
Ricardo
Top achievements
Rank 1
Answers by
Ricardo
Top achievements
Rank 1
Pavlina
Telerik team
Share this question
or