Click here to Skip to main content
15,889,808 members
Please Sign up or sign in to vote.
5.00/5 (2 votes)
See more:
i want to change the width of columns of gridview with mouse drag just like in window explorer
Posted
Comments
[no name] 6-Jun-12 3:35am    
Have you ever taste the code?

if you want to change style with client events, you have too use client scripts, like jquery, something like this:
onmouseover="changeTheGridStyle()"
or search in google for jquery tools for your needs!
 
Share this answer
 
Hi,

If you are using Infragistics Grid, then there is one property for each column named AllowResize. Set it to true.

Happy Coding
:)
 
Share this answer
 
hi..

Select your DataGridView ---> Go to DataGridView Properties (on Properties window)

--->AllowUserToResizeColumns===>True

Thank you

Happy Coding :)
 
Share this answer
 
There are many way

But I prefer you use OnMouseClick event
use cursor property and find movement and change width

diff = oldx-cursor.position.x
GridView1.Columns[0].ItemStyle.Width = GridView1.Columns[0].ItemStyle.Width+diff;

C#
In case of increasing width,
diff = 455-465 = 10;
then
GridView1.Columns[0].ItemStyle.Width = 50+10=60;


C#
In case of decreasing width,
diff = 475-465 = -10;
then
GridView1.Columns[0].ItemStyle.Width = 50+(-10)=40;</pre>

Hope this will help
All the best
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900