473,698 Members | 2,576 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Paint selected cells of Datagrid

Hi,

Can anyone give me examples of how can I hightlight cells of my datagrid? I
know that I must use ItemBound event and probably JavaScript.

The thing is that I have a anual calendar, constructed in a DataGrid. Then
what I want is select a range of two dates in that same calendar to do any
action.
Can anyone gives me examples??????


--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca
Nov 19 '05 #1
5 1465
Ruca,

See if this article helps:

http://www.codeproject.com/aspnet/PrettyDatagrids.asp

One part of it show how to highlight single cells based on data values

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"ruca" <ru***@iol.pt > wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Hi,

Can anyone give me examples of how can I hightlight cells of my datagrid?
I know that I must use ItemBound event and probably JavaScript.

The thing is that I have a anual calendar, constructed in a DataGrid. Then
what I want is select a range of two dates in that same calendar to do any
action.
Can anyone gives me examples??????


--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca

Nov 19 '05 #2
Hi,

Thank's, but it is not whta I really want.
I want to select single cells (but they must be followed) and paint them
selfs.

--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca

"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate. com> escreveu na
mensagem news:eK******** ******@tk2msftn gp13.phx.gbl...
Ruca,

See if this article helps:

http://www.codeproject.com/aspnet/PrettyDatagrids.asp

One part of it show how to highlight single cells based on data values

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"ruca" <ru***@iol.pt > wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Hi,

Can anyone give me examples of how can I hightlight cells of my datagrid?
I know that I must use ItemBound event and probably JavaScript.

The thing is that I have a anual calendar, constructed in a DataGrid.
Then what I want is select a range of two dates in that same calendar to
do any action.
Can anyone gives me examples??????


--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca


Nov 19 '05 #3
Ruca,

Do you mean you want to be able to hover over (or click) on a cell
clientside and have it highlight?

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"ruca" <ru***@iol.pt > wrote in message
news:e6******** ******@TK2MSFTN GP11.phx.gbl...
Hi,

Thank's, but it is not whta I really want.
I want to select single cells (but they must be followed) and paint them
selfs.

--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca

"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate. com> escreveu na
mensagem news:eK******** ******@tk2msftn gp13.phx.gbl...
Ruca,

See if this article helps:

http://www.codeproject.com/aspnet/PrettyDatagrids.asp

One part of it show how to highlight single cells based on data values

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"ruca" <ru***@iol.pt > wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Hi,

Can anyone give me examples of how can I hightlight cells of my
datagrid? I know that I must use ItemBound event and probably
JavaScript.

The thing is that I have a anual calendar, constructed in a DataGrid.
Then what I want is select a range of two dates in that same calendar to
do any action.
Can anyone gives me examples??????


--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca



Nov 19 '05 #4
Justin,

Yes, something like that. But the cells must be followed, because we are
talking about select days of a calendar.
--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca
"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate. com> escreveu na
mensagem news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Ruca,

Do you mean you want to be able to hover over (or click) on a cell
clientside and have it highlight?

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"ruca" <ru***@iol.pt > wrote in message
news:e6******** ******@TK2MSFTN GP11.phx.gbl...
Hi,

Thank's, but it is not whta I really want.
I want to select single cells (but they must be followed) and paint them
selfs.

--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca

"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate. com> escreveu na
mensagem news:eK******** ******@tk2msftn gp13.phx.gbl...
Ruca,

See if this article helps:

http://www.codeproject.com/aspnet/PrettyDatagrids.asp

One part of it show how to highlight single cells based on data values

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"ruca" <ru***@iol.pt > wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Hi,

Can anyone give me examples of how can I hightlight cells of my
datagrid? I know that I must use ItemBound event and probably
JavaScript.

The thing is that I have a anual calendar, constructed in a DataGrid.
Then what I want is select a range of two dates in that same calendar
to do any action.
Can anyone gives me examples??????


--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca



Nov 19 '05 #5
In that case use the item databound event to add a onmouseover javascript to
each cell.

The script will need to have an if then that checks the current value and
set's it to the opposite value on mouse over.

I have some simlar code:

1.. Private Sub DataGrid1_ItemD ataBound(ByVal sender As System.Object,
ByVal e As System.Web.UI.W ebControls.Data GridItemEventAr gs) Handles
DataGrid1.ItemD ataBound
2.. Try
3.. Dim itemType As ListItemType = e.Item.ItemType
4..
5.. If ((itemType = ListItemType.Pa ger) Or (itemType =
ListItemType.He ader) Or (itemType = ListItemType.Fo oter)) Then
6.. Return
7.. Else
8.. '---You'll have to change the code that get's the link button to
reflect the proper zero based column index:
9.. Dim button As LinkButton = CType(e.Item.Ce lls(3).Controls (0),
LinkButton)
10.. e.Item.Attribut es("onClick") =
Page.GetPostBac kClientHyperlin k(button, "")
11..
12.. '---Note that I've used javascript to show the cursor as a pointer
when a row is hovered over so that users will know it's clickable.
13.. e.Item.Attribut es.Add("onMouse Over",
"javascript:thi s.style.cursor= 'pointer';")
14.. e.Item.Attribut es.Add("omMouse Out",
"javascript:thi s.style.cursor= 'normal';")
15.. End If
16.. Catch ex As Exception
17.. '---Handle Exception
18.. End Try
19.. End Sub
It's the onmouseover portion you'll want to pay attention to. Also, this
code is adding the javascript to the entire row. You'll want to specify
adding it to each cell within e.Item (e.Item is the row).

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"ruca" <ru***@iol.pt > wrote in message
news:OZ******** *****@TK2MSFTNG P12.phx.gbl...
Justin,

Yes, something like that. But the cells must be followed, because we are
talking about select days of a calendar.
--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca
"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate. com> escreveu na
mensagem news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Ruca,

Do you mean you want to be able to hover over (or click) on a cell
clientside and have it highlight?

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"ruca" <ru***@iol.pt > wrote in message
news:e6******** ******@TK2MSFTN GP11.phx.gbl...
Hi,

Thank's, but it is not whta I really want.
I want to select single cells (but they must be followed) and paint them
selfs.

--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca

"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate. com> escreveu
na mensagem news:eK******** ******@tk2msftn gp13.phx.gbl...
Ruca,

See if this article helps:

http://www.codeproject.com/aspnet/PrettyDatagrids.asp

One part of it show how to highlight single cells based on data values

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"ruca" <ru***@iol.pt > wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
> Hi,
>
> Can anyone give me examples of how can I hightlight cells of my
> datagrid? I know that I must use ItemBound event and probably
> JavaScript.
>
> The thing is that I have a anual calendar, constructed in a DataGrid.
> Then what I want is select a range of two dates in that same calendar
> to do any action.
>
>
> Can anyone gives me examples??????
>
>
>
>
> --
> Programming ASP.NET with VB.NET
> Thank's (if you try to help me)
> Hope this help you (if I try to help you)
> ruca
>



Nov 19 '05 #6

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

Similar topics

2
2861
by: Maggie Eusebio Schock | last post by:
Hi, I would like to understand when a selected cell, selected row or selected rows in the DataGrid control ends up on the clipboard. All I know is that the selection ends up on the clipboard, because when I issue a copy command then paste to an editor, the selected datagrid cell(s) end up on the editor. Maybe a better way of stating my question is during what event (e.g. MouseUp) do the selected cells end up on the clipboard (I...
3
2919
by: Mark.Larsen | last post by:
I made a class that extends DataGridColumnStyle. In the Paint override I draw a border around each cell in the column. All cells look fine except for the last one (final row). The lines I draw in the far right and bottom of the cell don't show. I can draw 1 pixel up from the bottom and 1 pixel left of the right border. What is preventing me from painting the border around this last cell?
1
2384
by: Empire City | last post by:
I have an ASP.NET form with a DataGrid and Button. I want to put a RadioButtonList in a DataGrid cell. I bind it to an ArrayList which has a ListItem in the cell. The display part works fine. I then check some boxes and hit the submit button. I can't seem to get the value that is selected on the RadioButton List. I don't want to use the EditTemplate thing I just want to click on the radiobutton and submit the form. I also don't want to do...
6
5395
by: Jenna Alten | last post by:
I have a datagrid with a template column that contains a dropdown list. I currently fill and display the dropdown list on the page load. This is working correctly. I am NOT using an Edit Column. I am receiving errors when trying to set the selected value of the dropdown within the ItemDataBound() subroutine. Below is the code I am using. I hope someone can tell me if this is possible. '''HTML''' <asp:datagrid id="dgAssignments"...
3
1977
by: Mike Cooper | last post by:
I have been staring at the above error for over a week now! I have a an inherited data class looking like thus: Public Class DataGridBoolColumnInherit Inherits System.Windows.Forms.DataGridBoolColumn Protected Overloads Overrides Sub Paint(ByVal g As Graphics, ByVal bounds As Rectangle, ByVal As CurrencyManager, ByVal rowNum As Integer, ByVal backBrush As Brush, ByVal foreBrush As Brush, ByVal alignToRight As Boolean)
5
5131
by: ruca | last post by:
Hi, Can anyone give me examples of how can I hightlight cells of my datagrid? I know that I must use ItemBound event and probably JavaScript. The thing is that I have a anual calendar, constructed in a DataGrid. Then what I want is select a range of two dates in that same calendar to do any action.
4
5846
by: gordon | last post by:
Hi I hav e a smallish app that has a datagridview. A user can select some columns in the datagrid, and i have a button that i would like to use to copy the rows that are selected to the clipboard or to a text file. Any ideas how to accomplish this? I have all the controls working in this form apart from this feature.
0
1606
by: Ed Dror | last post by:
Hi there, I'm using Visual studio 2005 pro and I want to pass parameter from datagrid selected cell to textbox I have Select button in my datagrid I wrote this Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound Try
1
5035
by: Dinu | last post by:
hi i am having a gridview in aspx page and a usercontrol in master page of that page now what i want is selected row text to be displayed in usercontrol i wrote code as follows: Protected Sub gvwServices_SelectedIndexChanged(ByVal sender As Object,
0
8609
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9030
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...
1
8899
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8871
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...
0
7738
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5861
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
4622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
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
2007
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.