Click here to Skip to main content
13,260,019 members (52,089 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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
Updated 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
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.171114.1 | Last Updated 5 Jan 2013
Copyright © CodeProject, 1999-2017
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