Articles in this section
Category / Section

How to restrict the resizing cursor for the columns?

1 min read

In order to restrict the resizing cursor for particular column, ResizingColumns event can be used. In that event, the resizing cursor can be restricted for particular column by setting the e.Cancel property value as True.

Code Snippet

C#

this.gridDataBoundGrid1.ResizingColumns += gridDataBoundGrid1_ResizingColumns;
void gridDataBoundGrid1_ResizingColumns(object sender, GridResizingColumnsEventArgs e)
{
   if(this.gridDataBoundGrid1.Binder.InternalColumns[e.Columns.Right - 1].HeaderText == "Description")
   {
       e.Cancel = true;
   }
}

 

VB

Private Me.gridDataBoundGrid1.ResizingColumns += AddressOf gridDataBoundGrid1_ResizingColumns
Private Sub gridDataBoundGrid1_ResizingColumns(ByVal sender As Object, ByVal e As GridResizingColumnsEventArgs)
If Me.gridDataBoundGrid1.Binder.InternalColumns(e.Columns.Right - 1).HeaderText = "Description" Then
                  e.Cancel = True
   End If
End Sub

 

Sample Links

C#: RestrictResizingCursor_CS

VB: RestrictResizingCursor_VB

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied