473,383 Members | 1,868 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,383 software developers and data experts.

problems with datagridview rowheader value

I have an application where a datagridview is used to display some data, a datatable is bounded to it, and i want to put some text in the front of some rows to indicate that they are different from others.

my code checks the rows and used the following

mydatagridview.Rows.Item(iCnt).HeaderCell.Value = "A"

to set the row header values, it was fine when the data was first loaded. however, when I sort the datagridview by clicking the column header, these rowheadercell values disappear...

anybody knows how to keep the row header values after the sorting? thanks a lot!!
Apr 22 '10 #1

✓ answered by semomaniz

you will have to do this while binding the data. Create a OnDataBinding event to handle it

2 4037
semomaniz
210 Expert 100+
you will have to do this while binding the data. Create a OnDataBinding event to handle it
Apr 23 '10 #2
@semomaniz
thanks! so my understanding is that the header text is not bound to the gridview datasource, and sorting will erase all the older rows in the gridview, and reload from the datasource, is that correct?

I don't know how to create an OnDataBinding event, but i worked around by re-creating header text on sorted event. it works now... thanks again for your help.
Apr 23 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: saravanan_article | last post by:
Hi Team, This is saravanan i am new to C#.. I am using VS2005 for my windows based application.. I am using DataGridView to show the values.. What i want is i want to display the text in the...
2
by: Rich | last post by:
Hello, Some database applicatins have a tooltip feature where when you are dragging the scrollbar of the table view a tooltip appears next to the mouse cursor displaying the approximate record...
4
by: GS | last post by:
Hello, In a DataGridView, I programmaticly select a row with: dataGridView1.Rows.Selected = true; That row is selected and blue, but... In the RowHeader, the little black arrow is still on...
5
by: Roger | last post by:
I am trying to do a 'simple' task in a DGV control. The problem is this. I have an unbound DGV with all 'AllowUser' options disabled. RowHeader.Visible=False ColumnHeader.Text is labelled as...
0
by: =?Utf-8?B?UmljaA==?= | last post by:
In a datagridview, the first column header cell is columnHeader(0), which is immediately to the right of the Top Left Corner Select All cell. And the first RowHeader cell is RowHeaderCell(0) which...
1
nev
by: nev | last post by:
i have a normal datagridview were i want to display the rowcount in the rowheader. how will i do it?
1
by: =?Utf-8?B?Q2hyaXN0aWFuIFdlaW5lcnQ=?= | last post by:
Hello, I currently fight with a problem during the derivative of WinForm controls. In Visual Studio I created a new User Control. This control is derived from the DataGridView of the...
3
by: Tony K | last post by:
VB 2005 - Windows Vista I have a form that seems to lock up when the number of rows exceed the height of the datagridview. The following code executes when data is received through the serial...
3
by: sheridan | last post by:
Hi everyone. I'm hoping somone can help me, because I've been stuck on this all evening and haven't found the answer online yet. I have a DataGridView control and have managed to change all of...
0
by: priyamtheone | last post by:
I'm trying to make a datagridview column to act like a datetimepicker column (C#.Net 2005). These are the behaviours that the dgv should have: 1) Initially all the cells of the dtp column should be...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.