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

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 21 '05 #1
5 5119
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****************@TK2MSFTNGP12.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 21 '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**************@tk2msftngp13.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****************@TK2MSFTNGP12.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 21 '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**************@TK2MSFTNGP11.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**************@tk2msftngp13.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****************@TK2MSFTNGP12.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 21 '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****************@tk2msftngp13.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**************@TK2MSFTNGP11.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**************@tk2msftngp13.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****************@TK2MSFTNGP12.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 21 '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_ItemDataBound(ByVal sender As System.Object,
ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles
DataGrid1.ItemDataBound
2.. Try
3.. Dim itemType As ListItemType = e.Item.ItemType
4..
5.. If ((itemType = ListItemType.Pager) Or (itemType =
ListItemType.Header) Or (itemType = ListItemType.Footer)) 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.Cells(3).Controls(0),
LinkButton)
10.. e.Item.Attributes("onClick") =
Page.GetPostBackClientHyperlink(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.Attributes.Add("onMouseOver",
"javascript:this.style.cursor='pointer';")
14.. e.Item.Attributes.Add("omMouseOut",
"javascript:this.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*************@TK2MSFTNGP12.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****************@tk2msftngp13.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**************@TK2MSFTNGP11.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**************@tk2msftngp13.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****************@TK2MSFTNGP12.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 21 '05 #6

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

Similar topics

2
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,...
3
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...
1
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...
6
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...
5
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,...
5
by: Samy | last post by:
Hi There, I have a label in a datagrid which I make it a input type = radio in ItemDataBound so that radio buttons are shown in the datagrid. This is how I have it... ASPX... <asp:Label...
3
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...
4
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...
0
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...
1
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: ...
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: 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
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
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...
0
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...

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.