473,388 Members | 1,496 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Problem with DataGrid Headers

Hi,

I've a dataGrid, and When I click with the mouse on one of it's header the
DataGrid_Click event is called. I don't have problem with the event, but
strange things happen to the dataGrid after I click on one of the headers. I
have DataSet that bounded to this DataGrid so i could write into the
dataGrid, but when i click on the headers new rows are suddenly added,
sometime as a first row, sometimes between two exsisting rows. I change the
value of AllowSorting and AllowNavagtion to false, and still same problem.

How can I prevent that?

Thanks,
Gidi.
May 30 '06 #1
3 1444
If this posts twice, my apologies as it appears the site had a problem earlier.

What are you using as the DataSource for your DataGrid? If you are using
the DataSet you may be seeing a "refreshed" version for some reason. If you
use a DataView instead, you should not see any updates unless you repopulate
the DataView explictly.

HTH
"Gidi" wrote:
Hi,

I've a dataGrid, and When I click with the mouse on one of it's header the
DataGrid_Click event is called. I don't have problem with the event, but
strange things happen to the dataGrid after I click on one of the headers. I
have DataSet that bounded to this DataGrid so i could write into the
dataGrid, but when i click on the headers new rows are suddenly added,
sometime as a first row, sometimes between two exsisting rows. I change the
value of AllowSorting and AllowNavagtion to false, and still same problem.

How can I prevent that?

Thanks,
Gidi.

May 30 '06 #2
Hi,

The dataSet is used only for adding new rows, and to sign events to some
cells. when i click on the dataGrid's headers i see a little arrow (like when
you press it for sorting), that's what i want to make sure won't happen.

Thanks,
Gidi.

"WhiteWizard" wrote:
If this posts twice, my apologies as it appears the site had a problem earlier.

What are you using as the DataSource for your DataGrid? If you are using
the DataSet you may be seeing a "refreshed" version for some reason. If you
use a DataView instead, you should not see any updates unless you repopulate
the DataView explictly.

HTH
"Gidi" wrote:
Hi,

I've a dataGrid, and When I click with the mouse on one of it's header the
DataGrid_Click event is called. I don't have problem with the event, but
strange things happen to the dataGrid after I click on one of the headers. I
have DataSet that bounded to this DataGrid so i could write into the
dataGrid, but when i click on the headers new rows are suddenly added,
sometime as a first row, sometimes between two exsisting rows. I change the
value of AllowSorting and AllowNavagtion to false, and still same problem.

How can I prevent that?

Thanks,
Gidi.

May 30 '06 #3
Ok, if all you are trying to do is disable the sorting capability on the
headers, in your DataStyles you can set the AllowSorting property to false:

private void ConfigureTestPointDatagrid()
{
DataGridTableStyle tsTP = new DataGridTableStyle();
tsTP.MappingName = "TestPoints Table";
tsTP.AlternatingBackColor = SystemColors.Control;
tsTP.AllowSorting = false;

/* Add a GridColumnStyle and set its MappingName
to the name of a DataColumn in the DataTable.
Set the HeaderText and Width properties. */
//Code to ID and format each column goes here THEN

testPointDatagrid.TableStyles.Add(tsTP);

HTH

"Gidi" wrote:
Hi,

The dataSet is used only for adding new rows, and to sign events to some
cells. when i click on the dataGrid's headers i see a little arrow (like when
you press it for sorting), that's what i want to make sure won't happen.

Thanks,
Gidi.

"WhiteWizard" wrote:
If this posts twice, my apologies as it appears the site had a problem earlier.

What are you using as the DataSource for your DataGrid? If you are using
the DataSet you may be seeing a "refreshed" version for some reason. If you
use a DataView instead, you should not see any updates unless you repopulate
the DataView explictly.

HTH
"Gidi" wrote:
Hi,

I've a dataGrid, and When I click with the mouse on one of it's header the
DataGrid_Click event is called. I don't have problem with the event, but
strange things happen to the dataGrid after I click on one of the headers. I
have DataSet that bounded to this DataGrid so i could write into the
dataGrid, but when i click on the headers new rows are suddenly added,
sometime as a first row, sometimes between two exsisting rows. I change the
value of AllowSorting and AllowNavagtion to false, and still same problem.

How can I prevent that?

Thanks,
Gidi.

May 30 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Billy Jacobs | last post by:
I am using a datagrid to display some data. I need to create 2 header rows for this grid with columns of varying spans. In html it would be the following. <Table> <tr> <td colspan=8>Official...
3
by: sam | last post by:
Hello Group, Havent had luck posting it to microsoft.public.dotnet.framework.aspnet.datagridcontrol group. Excuse me for the cross posting. I have a datagrid which needs to be split into multiple...
9
by: Morten | last post by:
Hi! I have a problem displaying some values in a datagrid. I have an array that consists of a number of objects. Each object has 2 properties: Name and a list of web addresses. (e.g: Name:...
5
by: Ben | last post by:
Is there any way to freeze the DataGrid headers so that the headers are always viewable while srolling down? Thanks in advance, Ben!
0
by: Hai Nguyen | last post by:
Below is my code, would anybody please figure out why it did not display any thing. The database did not anything in there yet, what it does is the header field. It just shows me the headers only,...
2
by: gh0st54 | last post by:
hi still working on changing my data grid headers using resource files the thing is i always gat a count of 0 for my datagrid columns count, when will i get the columns count and when should i...
1
by: ElenaR | last post by:
I need to figure out how to name my column headers in a DataGrid. In VB6, I could write DataGrid1.Columns(0).Caption = "ID". What is the format for VB.NET? Thanks in Advance!
4
by: cooltech77 | last post by:
Hi, I am trying to build the following functionality in the datagrid. I have a lot of columns in the datagrid which are being populated from the database and the user needs to scroll...
0
by: rn5a | last post by:
A DataGrid control displays records from a SQL Server 2005 DB table. The AllowSorting property of the DataGrid has been set to True & the SortExpressions of the BoundColumns have been set to the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.