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

Get/Set Column Width from Client-side

1 Answer 389 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Valery
Top achievements
Rank 2
Valery asked on 19 Jul 2010, 07:59 AM
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,
V.

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 19 Jul 2010, 11:12 AM
Hello Valery,

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

ASPX:
<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;
    }
</script>

Thanks,
Princy.
Tags
Grid
Asked by
Valery
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
Share this question
or