473,803 Members | 3,424 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1655
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_Navig ate(object sender,

System.Windows. Forms.NavigateE ventArgs ne)
{
this.dataGrid1. Select(this.dat aGrid1.CurrentR owIndex);
}
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 OnCurrentCellCh anged(EventArgs e)
{
this.Select(thi s.CurrentRowInd ex);
}

protected override void OnVisibleChange d(EventArgs e)
{
if (this.CurrentRo wIndex > -1)
this.Select(thi s.CurrentRowInd ex);
}
}

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

protected override void Edit(System.Win dows.Forms.Curr encyManager source,
int rowNum, System.Drawing. Rectangle bounds, bool readOnly, string
instantText, bool cellIsVisible)
{
if (this.ReadOnly)
return;
else
base.Edit(sourc e, rowNum, bounds, readOnly, instantText,
cellIsVisible);
}

HTH,
Radovan

"Serg Matvienko" <se******@hotma il.com> wrote in message
news:O1******** *****@TK2MSFTNG P12.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_Navig ate(object sender,
System.Windows. Forms.NavigateE ventArgs ne)
{
this.dataGrid1. Select(this.dat aGrid1.CurrentR owIndex);
}

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
7935
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 header of the datagrid in the "ItemDataBound" method of the grid. However, once, they are added in the grid, i seem to lose the event handler for the same control. Is there anyone who has tried this before and knows why this is hapenning ??
3
4276
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 several examples on the web. They all seem to have problems, though that I've been unable to resolve. The most promising example I have found is at:
5
9178
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 a datagrid do >> not << constitute a set of 'selected' records. Apparently one and only one row may be 'selected' in a datagrid. By selected row I mean the row
3
2163
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) just data in controls not whole page. Working on: - Win XP Pro
0
1052
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 it's displayed. Can anyone give me a good suggestion for how to do this to a whole DataTable (or datagrid if that's a better place to do it) that may have any number of rows and columns? As I typed this I thought maybe the OnItemDatabound event...
1
1856
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 ItemCommand event. I want to make the entire row clickable so that the user can click any column and the event gets fired. Is there a way to do this Thanks
4
4203
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 complicated control like datagrid.
3
1265
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 my_service.Statement Dim my_data As New my_service.my_data
3
3145
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
9703
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10555
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10317
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10069
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7607
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6844
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4277
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2974
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.