Click here to Skip to main content
Rate this: bad
good
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 6:56am
Edited 5-Jan-13 7:38am
v2
Rate this: bad
good
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">
</asp:GridView>
</div>
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">
 </asp:GridView>
</asp:Panel>
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

By setting the
DataGridView.Enabled=false;
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.
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 445
1 CHill60 410
2 Sergey Alexandrovich Kryukov 354
3 BillWoodruff 190
4 PIEBALDconsult 160


Advertise | Privacy | Mobile
Web02 | 2.8.141015.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