By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,244 Members | 1,972 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,244 IT Pros & Developers. It's quick & easy.

Paint selected cells of Datagrid

P: n/a
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
Share this Question
Share on Google+
5 Replies


P: n/a
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 19 '05 #2

P: n/a
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 19 '05 #3

P: n/a
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 19 '05 #4

P: n/a
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 19 '05 #5

P: n/a
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 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.