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

dynamic resize grid width by pixels

2 Answers 107 Views
Grid
This is a migrated thread and some comments may be shown as answers.
John Davis
Top achievements
Rank 2
John Davis asked on 23 Jun 2010, 12:22 PM
In page load I want to reduce grid width by 250px.
I tried:

 

 

cnt = Convert.ToInt32(RadGrid1.Width) - 250

 

 

 

RadGrid1.Width = System.Web.UI.WebControls.Unit.Pixel(cnt)

but it did not work.

How can I do it?

 

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 23 Jun 2010, 01:46 PM
Hi,

A slight modification in your code worked well for me. Give a try with this.

CS:
 
    protected void Page_Load(object sender, EventArgs e) 
    { 
        int cnt = Convert.ToInt32(RadGrid1.Width.Value) - 250; 
        RadGrid1.Width = System.Web.UI.WebControls.Unit.Pixel(cnt); 
    } 

Note: I have already set the Width for RadGrid in the markup:
     <telerik:RadGrid Width="1000" Skin="Outlook" . ..



-Shinu.
0
John Davis
Top achievements
Rank 2
answered on 23 Jun 2010, 03:35 PM
Shinu:
Yes your modified example worked perfectly.  Thank you.
John
Tags
Grid
Asked by
John Davis
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
John Davis
Top achievements
Rank 2
Share this question
or