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

Last Columns getting invisible while frozen the first column in grid

2 Answers 46 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rk.MooRthy(DLL Version : 2008.3.1314.35) asked on 19 Sep 2013, 08:08 AM
Hi,
I have one rad grid with 20 more columns, While i frozen the first column, the last three columns will be in out of the grid..
and i used to show full columns in grid with "UseStaticHeaders=True",
Bcoz am getting different count of columns from DB when i show a grid.

This is my grid:
------------------
<telerik:RadGrid ID="RadGrid2" runat="server" Skin="Vista" AutoGenerateColumns="false"
                    OnItemDataBound="RadGrid2_ItemDataBound" OnNeedDataSource="RadGrid2_NeedDataSource"
                    OnPreRender="RadGrid2_PreRender" Height="400px" Width="970px">
                    <MasterTableView HeaderStyle-CssClass="disable-highlight" Width="98%" HeaderStyle-HorizontalAlign="Center"
                        HeaderStyle-Wrap="true" HeaderStyle-Height="52px">
                        <Columns>
                        </Columns>
                    </MasterTableView>
                    <ClientSettings Scrolling-AllowScroll="true" Resizing-AllowColumnResize="true" Scrolling-SaveScrollPosition="true"
                        Scrolling-FrozenColumnsCount="2" Scrolling-UseStaticHeaders="true">
                        <Selecting AllowRowSelect="true" />
                        <ClientEvents OnColumnDblClick="myDblClickEvent" OnRowDblClick="RowSelectCheck" />
                        <Scrolling AllowScroll="true" UseStaticHeaders="true" />
                    </ClientSettings>
                </telerik:RadGrid>
 
In Code Behind:
------------------
I have added the dynamic columns from DB like following.
 
GridBoundColumn objBound = new GridBoundColumn();
            RadGrid2.MasterTableView.Columns.Add(objBound);
            objBound.HeaderText = dtnewd.Columns[1].ToString().ToString();
            objBound.UniqueName = dtnewd.Columns[1].ToString().ToString();
            objBound.DataType = typeof(string);
            objBound.DataField = dtnewd.Columns[1].ToString();
            objBound.HeaderStyle.Width = 100;
            objBound.HeaderStyle.Wrap = true;
            objBound.ItemStyle.Width = 100;
            objBound.ItemStyle.Wrap = true;

Can you anyone help me..?


Thanks
-Rk.Moorthy

2 Answers, 1 is accepted

Sort by
0
answered on 20 Sep 2013, 07:22 AM
Hi,
Can you anyone help me regarding this issue..?

-Rk.MooRthy
0
Venelin
Telerik team
answered on 23 Sep 2013, 03:48 PM
Hi Rk.MooRthy,

It is highly unrecommended to use the property ItemStyle.Width at all. Therefore please replace objBound.HeaderStyle.Width = 100 with HeaderStyle.Width = Unit.Pixel(100) and remove objBound.ItemStyle.Width = 100.

GridBoundColumn objBound = new GridBoundColumn();
RadGrid2.MasterTableView.Columns.Add(objBound);
objBound.HeaderText = dtnewd.Columns[1].ToString().ToString();
objBound.UniqueName = dtnewd.Columns[1].ToString().ToString();
objBound.DataType = typeof(string);
objBound.DataField = dtnewd.Columns[1].ToString();
objBound.HeaderStyle.Width = 100;
objBound.HeaderStyle.Wrap = true;
objBound.ItemStyle.Width = 100;
objBound.ItemStyle.Wrap = true;

I hope this helps.

Regards,
Venelin
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
Answers by
Venelin
Telerik team
Share this question
or