Last Columns getting invisible while frozen the first column in grid

3 posts, 0 answers
  1. Rk.MooRthy(DLL Version : 2008.3.1314.35)
    Rk.MooRthy(DLL Version : 2008.3.1314.35) avatar
    21 posts
    Member since:
    Jun 2013

    Posted 19 Sep 2013 Link to this post

    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. Rk.MooRthy(DLL Version : 2008.3.1314.35)
    Rk.MooRthy(DLL Version : 2008.3.1314.35) avatar
    21 posts
    Member since:
    Jun 2013

    Posted 20 Sep 2013 Link to this post

    Hi,
    Can you anyone help me regarding this issue..?

    -Rk.MooRthy
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Venelin
    Admin
    Venelin avatar
    352 posts

    Posted 23 Sep 2013 Link to this post

    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.
Back to Top