Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C#
how to enable scroll bar options of datagridview while DataGridView select ability is disabled. help me with this.THANX?
 dataGridView1.Enabled = false;
Posted 5-Jan-13 7:56am
Edited 5-Jan-13 8:38am
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

GridView still have not ScrollBars property. To create GridView with horizontal or vertical scrollbar you need to place GridView inside <div > tag or inside Panel control.
GridView inside <div > HTML tag
To produce GridView scrollbars with div tag, use this code:
<div style="width:100%; height:300; overflow:auto;">
<asp:GridView ID="GridView1" runat="server">
GridView inside Panel Control
To create GridView scrollbars with a little help of Panel control, use this code:
<asp:Panel ID="Panel1" runat="server" ScrollBars="Both" Height="300" Width="100%">
 <asp:GridView ID="GridView1" runat="server">
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

By setting the
you are making the DataGridViewControl disabled for any operation.To use the scroll bar you can try the following other options.
a) DataGridView.ReadOnly = false;
b) dataGridColumn.ReadOnly = false;
c) addition to a or b, change the SelectionBackColor to white in DefaultCellStyle
d) call dataGridView.ClearSelection() method in your cell/row selection change method.

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

  Print Answers RSS
0 OriginalGriff 245
1 Kamal Rocks 184
2 Sergey Alexandrovich Kryukov 175
3 BillWoodruff 173
4 PIEBALDconsult 160
0 OriginalGriff 5,695
1 DamithSL 4,506
2 Maciej Los 4,007
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,180

Advertise | Privacy | Mobile
Web01 | 2.8.141216.1 | Last Updated 5 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100