Get/Set Column Width from Client-side

2 posts, 0 answers
  1. Valery
    Valery avatar
    45 posts
    Member since:
    Nov 2008

    Posted 19 Jul 2010 Link to this post

    Hi there,

    I would like to store and restore column widths of a RadGrid from Javascript but unfortunately I can't find a method to set the width of a column. Is there such a function in the client-side API?

    Best regards,
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 19 Jul 2010 Link to this post

    Hello Valery,

    Check out the following code snippet which changes the column width on a client side ButtonClick event.

    <asp:Button ID="Button1" runat="server"  OnClientClick="return changeWidth();" Text="columnWidth" />

    Java Script:
    <script type="text/javascript">
        function changeWidth()
            var grid = $find("<%=RadGrid1.ClientID %>");
            var MasterTable = grid.get_masterTableView();
            MasterTable.getColumnByUniqueName("ColumnUniqueName").get_element().width = "500px";
            return false;

Back to Top