473,395 Members | 2,151 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,395 software developers and data experts.

How can I hihglight the whole row of DataGrid ?

Hi everybody,

My dataGrid is "for read" only.How can I hihglight the whole row of DataGrid
when I am navigating through rows? Now I can see only a small triangle on
the right side of dataGrid moving.

Thanks a lot in advance,
Serg
Nov 16 '05 #1
4 1640
Hi Serg
You can achieve this function by selecting the current row index while
navigations . you will be using the select function of the datagrid passing
the it the current row selected. This should be implemented in the
navigation event of your grid. Here is a snippet
private void dataGrid1_Navigate(object sender,

System.Windows.Forms.NavigateEventArgs ne)
{
this.dataGrid1.Select(this.dataGrid1.CurrentRowInd ex);
}
hope this helps
Mohamed Mahfouz
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC

Nov 16 '05 #2
Hi Mohamed,

Thank you very much for your help, but unfortunately it doesn't work this
way. Maybe you could advise me a good book about window form's data grids. I
have seen lots of book about web data grids, but never about window form's
ones.

Sincerely,

Serg
Nov 16 '05 #3
Hi Serg,

Try this

public class NewGrid : DataGrid
{
public NewGrid()
{
this.ReadOnly = true;
}

protected override void OnCurrentCellChanged(EventArgs e)
{
this.Select(this.CurrentRowIndex);
}

protected override void OnVisibleChanged(EventArgs e)
{
if (this.CurrentRowIndex > -1)
this.Select(this.CurrentRowIndex);
}
}

If you dont want to see focused EditBox in the Grid's columns, you should
inherit DataGridTextBoxColumn and override Edit method

protected override void Edit(System.Windows.Forms.CurrencyManager source,
int rowNum, System.Drawing.Rectangle bounds, bool readOnly, string
instantText, bool cellIsVisible)
{
if (this.ReadOnly)
return;
else
base.Edit(source, rowNum, bounds, readOnly, instantText,
cellIsVisible);
}

HTH,
Radovan

"Serg Matvienko" <se******@hotmail.com> wrote in message
news:O1*************@TK2MSFTNGP12.phx.gbl...
Hi Mohamed,

Thank you very much for your help, but unfortunately it doesn't work this
way. Maybe you could advise me a good book about window form's data grids. I have seen lots of book about web data grids, but never about window form's
ones.

Sincerely,

Serg

Nov 16 '05 #4
Hi Serg
Here you are some links that would enough to get you acquainted with
winForms datagrids
http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp (simple question and
answer form )
http://www.codeproject.com/cs/miscctrl/#Grid+controls ( some source code
examples with illustration )
about you problem again what you need to do is
" Select your dataGrid in the design window
" Form the property pane , select the event tab
" Double click the event Navigate
" Add the handler like so :
private void dataGrid1_Navigate(object sender,
System.Windows.Forms.NavigateEventArgs ne)
{
this.dataGrid1.Select(this.dataGrid1.CurrentRowInd ex);
}

Mohamed Mahfouz
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC

Nov 16 '05 #5

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

Similar topics

8
by: Ashish Shridharan | last post by:
Hi All I have been trying to add a control to the header cell of a datagrid on my ASP.NET page. These controls are defined in the HTML as ASP.NET web controls. They are being added into the...
3
by: Bill C. | last post by:
Hello, I know this has been discussed a lot already because I've been searching around for information the last few weeks. I'm trying to implement a DataGridComboBoxColumn class. I've found...
5
by: BBFrost | last post by:
Win2000 ..Net 1.1 SP1 c# using Visual Studio Ok, I'm currently in a "knock down - drag out" tussle with the .Net 1.1 datagrid. I've come to realize that a 'block' of rows highlighted within...
3
by: Damjan Vengu¹t | last post by:
Hey ! I have a WebForm with several controls on it (text boxes, buttons, datagrid, listboxes,...). I want to refresh the data in those controls every 1-2 seconds. How do I refresh (reload)...
0
by: MattB | last post by:
I'm writing a utility page in asp.net that will return raw output from a database to a datagrid. I want to be able to see markup tags, so I need to perform a URLEncode() to all the text before...
1
by: RJN | last post by:
Hi I have a datagrid which has about 6 template columns. Currently the first template column has a link button and rest all are label controls. Now I can click on the first column to fire an...
4
by: tasiekk | last post by:
I need to know how i can resize datagrid on a page when user will resize web browser window or maximize this window. Resizeing normal DIV is simple - expression but i dont know how to resize more...
3
by: David | last post by:
Hi all, This is a weird one. I have been asked to look at an intermittent fault. Basically, I have a webservice that is delivering info into a datagrid. Dim Statement As New...
3
by: mnishani | last post by:
Is there any way to add a default value to a datagrid column(for the whole column - eg : system date) . I'm using vs2003 and datagrid and using dataadapter to update the grid. Thanks in advance
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.