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

Column width not adjusting

1 Answer 27 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Amit
Top achievements
Rank 1
Amit asked on 27 Aug 2013, 08:20 AM
I am continuing the thread cause it is related to the width of column.

 Actually I have column like decline,Delete,And approve they are visible true or false according to the roll of logged in Employee.
I am troubling in setting the width of all columns (I have given width in percentage )I have used table layout to fixed

Please help me to give correct width if columns are hidden or visible at run time.
In attached image I have hide delete ,decline check box columns as he is normal user.

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 26 Sep 2013, 11:40 AM
Hi,

You can set the width of a column from ASPX side as follows :
<telerik:GridBoundColumn UniqueName="OrderID" DataField="OrderID" HeaderText="OrderID" >
    <HeaderStyle Width="100px" />
</telerik:GridBoundColumn>

or from Code behind as:
protected void RadGrid1_PreRender(object sender, EventArgs e)
    {
        GridColumn gridCol = RadGrid1.MasterTableView.GetColumn("OrderID");
        gridCol.HeaderStyle.Width = Unit.Pixel(100);
    }

Then to hide a column you can try:
RadGrid1.MasterTableView.GetColumn("OrderID").Visible = false;

If this doesn't help.Please provide your full code snippet.

Thanks,
Princy
Tags
Grid
Asked by
Amit
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Share this question
or