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

RadGrid Remove Blank Space...

6 Answers 331 Views
Grid
This is a migrated thread and some comments may be shown as answers.
raaj
Top achievements
Rank 1
raaj asked on 26 Apr 2010, 02:50 PM
Hi Team,

Am using Radgrid in my application, i just want to remove the blank space coming at the end of column as shown in attached screen shot. Pls. help me out.

Thanks
Rajesh N.

6 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 26 Apr 2010, 03:07 PM
Hi Rajesh,

If you have set explicit widths to all columns, then remove one of them.

If you have set no widths at all, then set TableLayout="Fixed" to the MasterTableView or width to the MasterTableView.

Greetings,
Dimo
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
raaj
Top achievements
Rank 1
answered on 26 Apr 2010, 03:56 PM
Thnks for your reply!!

My situation is TableLayout="Auto" and not using AllowResize

Thanks
Rajesh N.
0
Dimo
Telerik team
answered on 26 Apr 2010, 04:06 PM
Hi Rajesh,

It is not clear whether you resolved the issue or not. If not, please send your RadGrid declaration.

Sincerely yours,
Dimo
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
raaj
Top achievements
Rank 1
answered on 26 Apr 2010, 06:33 PM
Team,
 
My Code:
 
 <asp:Panel runat="server" ID="pnlContainer" ScrollBars = "Auto" Width="750px" Height="205px">
                                                                   
                                                                        <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False"  ShowFooter="True"
                                                                            Width="743px" Height="200px" GridLines="Both" AllowSorting="True" BorderColor = "White" OnColumnCreated="RadGrid1_ColumnCreated" OnItemCreated = "RadGrid1_ItemCreated" OnPreRender = "RadGrid1_PreRender" OnItemDataBound="RadGrid1_ItemDataBound"
                                                                            OnSortCommand="RadGrid1_SortCommand" Skin="Outlook" >
                                                                            <MasterTableView  TableLayout="Auto" >
                                                                            <%--<MasterTableView width="100px" AllowMultiColumnSorting="false"  AutoGenerateColumns="False" HeaderStyle-Wrap = "false" TableLayout="Auto" >--%>
                                                                            <%--<MasterTableView AllowMultiColumnSorting="false"  AutoGenerateColumns="False" HeaderStyle-Wrap = "false"  >--%>
                                                                           <%--<MasterTableView HeaderStyle-Width= "25px" HeaderStyle-Wrap = "false"  >--%>
                                                                             <Columns>
                                                                                    <telerik:GridTemplateColumn  HeaderText="HeaderField1" HeaderStyle-HorizontalAlign = "Center"   HeaderStyle-Wrap="false" UniqueName="TemplateColumn"
                                                                                        SortExpression="HeaderText">
                                                                                        <ItemTemplate>
                                                                                            <asp:LinkButton ID="Header" runat="server" OnClick="Header_Click" Text='<%#Eval("HeaderText")%>'
                                                                                                ToolTip='<%#Eval("HeaderValue")%>'></asp:LinkButton>
                                                                                                <asp:Label ID="lblHeader" runat="server"  Text='<%#Eval("HeaderText")%>'
                                                                                                ToolTip='<%#Eval("HeaderValue")%>'></asp:Label>
                                                                                        </ItemTemplate>
                                                                                        <ItemStyle Wrap = "false"  HorizontalAlign="Left" />
                                                                                        <FooterStyle HorizontalAlign="Left" />
                                                                                    </telerik:GridTemplateColumn>
                                                                                    <telerik:GridTemplateColumn HeaderText="CalcField1" HeaderStyle-HorizontalAlign = "Center" HeaderStyle-Wrap="false" UniqueName="TemplateColumn1"
                                                                                        SortExpression="Field1" Visible="false">
                                                                                        <ItemTemplate>
                                                                                            <asp:LinkButton ID="lnkCalcField1" runat="server" OnClick="Detail_Click" Text='<%#Eval("Field1")%>'
                                                                                                ToolTip='<%#Eval("HeaderValue")%>'></asp:LinkButton>
                                                                                                  <asp:Label ID="lblCalcField1" runat="server"  Text='<%#Eval("Field1")%>'
                                                                                                ToolTip='<%#Eval("HeaderValue")%>'></asp:Label>
                                                                                        </ItemTemplate>
                                                                                        <ItemStyle HorizontalAlign="Right" />
                                                                                        <FooterStyle HorizontalAlign="Right" />
                                                                                    </telerik:GridTemplateColumn>
                                                                                    <telerik:GridTemplateColumn HeaderText="CalcField2" HeaderStyle-HorizontalAlign = "Center" HeaderStyle-Wrap="false" UniqueName="TemplateColumn2"
                                                                                        SortExpression="Field2" Visible="false">
                                                                                        <ItemTemplate>
                                                                                            <asp:Label ID="lblCalcField2" runat="server" Text='<%#Eval("Field2")%>'></asp:Label>
                                                                                        </ItemTemplate>
                                                                                        <ItemStyle HorizontalAlign="Right" />
                                                                                        <FooterStyle HorizontalAlign="Right" />
                                                                                    </telerik:GridTemplateColumn>
                                                                                    <telerik:GridTemplateColumn HeaderStyle-Wrap="false" HeaderStyle-HorizontalAlign = "Center" HeaderText="CalcField3" UniqueName="TemplateColumn3"
                                                                                        SortExpression="Field3" Visible="false">
                                                                                        <ItemTemplate>
                                                                                            <asp:Label ID="lblCalcField3" runat="server" Text='<%#Eval("Field3")%>'></asp:Label>
                                                                                        </ItemTemplate>
                                                                                        <ItemStyle HorizontalAlign="Right" />
                                                                                        <FooterStyle HorizontalAlign="Right" />
                                                                                    </telerik:GridTemplateColumn>
                                                                                    <telerik:GridTemplateColumn HeaderStyle-Wrap="false" HeaderStyle-HorizontalAlign = "Center" HeaderText="CalcField4" UniqueName="TemplateColumn4"
                                                                                        SortExpression="Field4" Visible="false">
                                                                                        <ItemTemplate>
                                                                                            <asp:Label ID="lblCalcField4" runat="server" Text='<%#Eval("Field4")%>'></asp:Label>
                                                                                        </ItemTemplate>
                                                                                        <FooterStyle HorizontalAlign="Right" />
                                                                                        <ItemStyle HorizontalAlign="Right" />
                                                                                    </telerik:GridTemplateColumn>
                                                                                    <telerik:GridTemplateColumn HeaderStyle-Wrap="false" HeaderStyle-HorizontalAlign = "Center" HeaderText="CalcField5" UniqueName="TemplateColumn5"
                                                                                        SortExpression="Field5" Visible="false">
                                                                                        <ItemTemplate>
                                                                                            <asp:Label ID="lblCalcField5" runat="server" Text='<%#Eval("Field5")%>'></asp:Label>
                                                                                        </ItemTemplate>
                                                                                        <ItemStyle HorizontalAlign="Right" />
                                                                                        <FooterStyle HorizontalAlign="Right" />
                                                                                    </telerik:GridTemplateColumn>
                                                                                    <telerik:GridTemplateColumn HeaderStyle-Wrap="false" HeaderStyle-HorizontalAlign = "Center" HeaderText="CalcField6" UniqueName="TemplateColumn6"
                                                                                        SortExpression="Field6" Visible="false">
                                                                                        <ItemTemplate>
                                                                                            <asp:Label ID="lblCalcField6" runat="server" Text='<%#Eval("Field6")%>'></asp:Label>
                                                                                        </ItemTemplate>
                                                                                        <ItemStyle HorizontalAlign="Right" />
                                                                                        <FooterStyle HorizontalAlign="Right" />
                                                                                    </telerik:GridTemplateColumn>
                                                                                    <telerik:GridTemplateColumn HeaderStyle-Wrap="false" HeaderStyle-HorizontalAlign = "Center" HeaderText="CalcField7" UniqueName="TemplateColumn7"
                                                                                        SortExpression="Field7" Visible="false">
                                                                                        <ItemTemplate>
                                                                                            <asp:Label ID="lblCalcField7" runat="server" Text='<%#Eval("Field7")%>'></asp:Label>
                                                                                        </ItemTemplate>
                                                                                        <ItemStyle HorizontalAlign="Right" />
                                                                                        <FooterStyle HorizontalAlign="Right" />
                                                                                    </telerik:GridTemplateColumn>
                                                                                    <telerik:GridTemplateColumn HeaderStyle-Wrap="false" HeaderStyle-HorizontalAlign = "Center" HeaderText="CalcField8" UniqueName="TemplateColumn8"
                                                                                        SortExpression="Field8" Visible="false">
                                                                                        <ItemTemplate>
                                                                                            <asp:Label ID="lblCalcField8" runat="server" Text='<%#Eval("Field8")%>'></asp:Label>
                                                                                        </ItemTemplate>
                                                                                        <ItemStyle HorizontalAlign="Right" />
                                                                                        <FooterStyle HorizontalAlign="Right" />
                                                                                    </telerik:GridTemplateColumn>
                                                                                    <telerik:GridTemplateColumn HeaderStyle-Wrap="false" HeaderStyle-HorizontalAlign = "Center" HeaderText="CalcField9" UniqueName="TemplateColumn9"
                                                                                        SortExpression="Field9" Visible="false">
                                                                                        <ItemTemplate>
                                                                                            <asp:Label ID="lblCalcField9" runat="server" Text='<%#Eval("Field9")%>'></asp:Label>
                                                                                        </ItemTemplate>
                                                                                        <ItemStyle HorizontalAlign="Right" />
                                                                                        <FooterStyle HorizontalAlign="Right" />
                                                                                    </telerik:GridTemplateColumn>
                                                                                    <telerik:GridTemplateColumn HeaderStyle-Wrap="false" HeaderStyle-HorizontalAlign = "Center" HeaderText="CalcField10" UniqueName="TemplateColumn10"
                                                                                        SortExpression="Field10" Visible="false">
                                                                                        <ItemTemplate>
                                                                                            <asp:Label ID="lblCalcField10" runat="server" Text='<%#Eval("Field10")%>'></asp:Label>
                                                                                        </ItemTemplate>
                                                                                        <ItemStyle HorizontalAlign="Right" />
                                                                                        <FooterStyle HorizontalAlign="Right" />
                                                                                    </telerik:GridTemplateColumn>
                                                                                    <telerik:GridTemplateColumn HeaderStyle-Wrap="false" HeaderStyle-HorizontalAlign = "Center" HeaderText="CalcField11" UniqueName="TemplateColumn11"
                                                                                        SortExpression="Field11" Visible="false">
                                                                                        <ItemTemplate>
                                                                                            <asp:Label ID="lblCalcField11" runat="server"  Text='<%#Eval("Field11")%>'></asp:Label>
                                                                                        </ItemTemplate>
                                                                                        <ItemStyle HorizontalAlign="Right" />
                                                                                        <FooterStyle HorizontalAlign="Right" />
                                                                                    </telerik:GridTemplateColumn>
                                                                                    <telerik:GridTemplateColumn HeaderStyle-Wrap="false" HeaderStyle-HorizontalAlign = "Center" HeaderText="CalcField12" UniqueName="TemplateColumn12"
                                                                                        SortExpression="Field12" Visible="false">
                                                                                        <ItemTemplate>
                                                                                            <asp:Label ID="lblCalcField12" runat="server" Text='<%#Eval("Field12")%>'></asp:Label>
                                                                                        </ItemTemplate>
                                                                                        <ItemStyle HorizontalAlign="Right" />
                                                                                        <FooterStyle HorizontalAlign="Right" />
                                                                                    </telerik:GridTemplateColumn>
                                                                                </Columns>                                                                         
                                                                                <RowIndicatorColumn Visible="True">
                                                                                </RowIndicatorColumn>
                                                                              
                                                                            </MasterTableView>
                                                                           
                                                                            <ClientSettings>
                                                                            <Scrolling  AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="true" FrozenColumnsCount="0" />
                                                                                <%--<Scrolling AllowScroll = "true" UseStaticHeaders="true" SaveScrollPosition = "true"  />--%>
                                                                                <%--<Resizing  ClipCellContentOnResize="false" AllowColumnResize="true" AllowRowResize="True"  />--%>
                                                                              <%--<ClientEvents OnGridCreated="GridCreated" />--%>
                                                                            </ClientSettings>
                                                                           
                                                                        </telerik:RadGrid>
                                                                        <telerik:RadScriptManager ID="RadScriptManager1" runat="server" AsyncPostBackTimeout="240"   />
                                                                    </asp:Panel>
 
Note: Tell me one thing How can I find Radgrid Width after page loaded?
 
Thanks
Rajesh N.
0
Dimo
Telerik team
answered on 27 Apr 2010, 09:17 AM
Hi Rajesh,

I can see that you have not followed the guidelines from my previous post - please do so. Is there anything unclear about them?

"If you have set no widths at all, then set TableLayout="Fixed" to the MasterTableView or width to the MasterTableView."

As for your second question - you can get the width of the RadGrid like this:

gridObject.get_element().offsetWidth

The above will return the amount of horizontal space that the outer RadGrid <div> occupies on the page, including the borders.

gridObject.get_element().style.width

This will return the inline width style set to the outer RadGrid <div>, if such exists.

Similarly, you can find out the MasterTableView width like this:

gridObject.get_masterTableView().get_element().style.width

gridObject.get_masterTableView().get_element().offsetWidth


Sincerely yours,
Dimo
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
raaj
Top achievements
Rank 1
answered on 27 Apr 2010, 02:56 PM
Sorry Sir,
I'm new to this Telerik Controls. My development is fully based on these controls only. That's why I need your precious support.

Thanks
Rajesh N.
Tags
Grid
Asked by
raaj
Top achievements
Rank 1
Answers by
Dimo
Telerik team
raaj
Top achievements
Rank 1
Share this question
or