setting HeaderStyle of radgrid

3 posts, 0 answers
  1. Suvarna
    Suvarna avatar
    12 posts
    Member since:
    Jun 2009

    Posted 29 Dec 2009 Link to this post

    Hello,

    I am quiet weak in stylesheet .My query is not exactly related to radcontrols but its related to setting stylesheet for header. when the text of my header is greater than the width of that column, column increases it width automatically, i dont want to increase my column width. It will be ok if the text of header will overlap with the header of next column, how to set stylesheet for this. Quick reply will be appreciated.

    Thanks in advance

    Suvarna
  2. Dimo
    Admin
    Dimo avatar
    8446 posts

    Posted 29 Dec 2009 Link to this post

    Hello Suvarna,

    Table cells normally expand to enclose their content. Please set TableLayout="Fixed" to the MasterTableView to prevent this expansion.

    After this, depending on the RadGrid version, the header content will either overflow over the next column (older RadGrid versions) or it will be clipped (newer RadGrid versions).

    If you are using some of the latest versions and still want the content to overflow, then use the following CSS rule:

    .rgHeader
    {
              overflow : visible  !important ;
    }

    If you are using some of the older versions and want the content to be clipped, then use the following CSS rule:

    .rgHeader
    {
              overflow : hidden  !important ;
    }


    By the way, it will be better and more convenient if you post your forum threads in the correct forum sections. Thank you.


    Regards,
    Dimo
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 29 Dec 2009 Link to this post

    Hello Suvarna,

    You can also show the complete text as a tooltip for the header cell after clipping the extra characters in the header text.

    aspx:
     
    <MasterTableView AutoGenerateColumns="False" EditMode="InPlace" TableLayout="Fixed" 
        CommandItemDisplay="Top" DataSourceID="SqlDataSource1" DataKeyNames="CustomerID">    
        <Columns> 
           . . . 
            <telerik:GridBoundColumn DataField="CustomerID" HeaderText="CustomerIDLongheaderText" UniqueName="CustomerID"
                <HeaderStyle Width="100px" /> 
            </telerik:GridBoundColumn> 

    cs:
     
        protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
        { 
            if (e.Item is GridHeaderItem) 
            { 
                GridHeaderItem headerItem = (GridHeaderItem)e.Item; 
                headerItem["CustomerID"].ToolTip = headerItem["CustomerID"].Text; 
            } 
        } 

    -Shinu.
Back to Top