472,783 Members | 1,028 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,783 software developers and data experts.

inserting args into a DataList's <td> tag

I would like to have DHTML on my DataList so that when I hover over a cell,
it will change colors. I can't find a way to get onMouseOver into the
generated <td> from a DataList. There must be way to do this.... I am just
missing it I suppose.

Anyone know?

Thanks,
Steve
Nov 18 '05 #1
7 1289
I'm just guessing here (because I haven't tried it myself) but you might try
handling the ItemCreated event and processing it there... Something like
this:

Protected Sub myDataList_ItemCreated(sender as object, e as eventargs)
handles myDataList.ItemCreated
If e.Item.Type = Item or e.Item.Type = AlternatingItem Then
dim myItem as DataListItem = CType(e.Item, DataListItem)
myItem.Attributes("onMouseOver") = "javascript:none;"
End If
End Sub

Keep in mind that I just typed this in my news client and not in the IDE, so
its not guaranteed to work, but it may give you some ideas.
"Steve Klett" <sk************@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I would like to have DHTML on my DataList so that when I hover over a cell, it will change colors. I can't find a way to get onMouseOver into the
generated <td> from a DataList. There must be way to do this.... I am just missing it I suppose.

Anyone know?

Thanks,
Steve

Nov 18 '05 #2
Hi Chris,

Thanks for the reply.

Yeah, I found that I can use Attributes.Add() to do what I want. Weird
thing is... I have implemented it, but in the result HTML the attributes
aren't there. I've checked my schema, it's IE 5, so it's not that.

I've set a breakpoint in the DataBind event to see if it is actually firing,
it is. I have added this code to add the attributes. I suspect that my
DHTML syntax is off, but I should at least see the bad syntax in the result
HTML, but it's not there.
e.Item.Attributes.Add("onMouseEnter", "style.color = 'red'");

Any ideas?
"Chris Bower" <ch***********@SPAMunionfedbank.com> wrote in message
news:Ox*************@tk2msftngp13.phx.gbl...
I'm just guessing here (because I haven't tried it myself) but you might try handling the ItemCreated event and processing it there... Something like
this:

Protected Sub myDataList_ItemCreated(sender as object, e as eventargs)
handles myDataList.ItemCreated
If e.Item.Type = Item or e.Item.Type = AlternatingItem Then
dim myItem as DataListItem = CType(e.Item, DataListItem)
myItem.Attributes("onMouseOver") = "javascript:none;"
End If
End Sub

Keep in mind that I just typed this in my news client and not in the IDE, so its not guaranteed to work, but it may give you some ideas.
"Steve Klett" <sk************@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I would like to have DHTML on my DataList so that when I hover over a

cell,
it will change colors. I can't find a way to get onMouseOver into the
generated <td> from a DataList. There must be way to do this.... I am

just
missing it I suppose.

Anyone know?

Thanks,
Steve


Nov 18 '05 #3
Hmm... Sounds like it should work. I don't know why it would make a
difference, but try not doing the .Add and just accessing the
AttributesCollection directly:
e.Item.Attributes("onMouseEnter","style.color = 'red'");
"Steve Klett" <sk************@yahoo.com> wrote in message
news:Of**************@TK2MSFTNGP11.phx.gbl...
Hi Chris,

Thanks for the reply.

Yeah, I found that I can use Attributes.Add() to do what I want. Weird
thing is... I have implemented it, but in the result HTML the attributes
aren't there. I've checked my schema, it's IE 5, so it's not that.

I've set a breakpoint in the DataBind event to see if it is actually firing, it is. I have added this code to add the attributes. I suspect that my
DHTML syntax is off, but I should at least see the bad syntax in the result HTML, but it's not there.
e.Item.Attributes.Add("onMouseEnter", "style.color = 'red'");

Any ideas?
"Chris Bower" <ch***********@SPAMunionfedbank.com> wrote in message
news:Ox*************@tk2msftngp13.phx.gbl...
I'm just guessing here (because I haven't tried it myself) but you might try
handling the ItemCreated event and processing it there... Something like
this:

Protected Sub myDataList_ItemCreated(sender as object, e as eventargs)
handles myDataList.ItemCreated
If e.Item.Type = Item or e.Item.Type = AlternatingItem Then
dim myItem as DataListItem = CType(e.Item, DataListItem)
myItem.Attributes("onMouseOver") = "javascript:none;"
End If
End Sub

Keep in mind that I just typed this in my news client and not in the IDE, so
its not guaranteed to work, but it may give you some ideas.
"Steve Klett" <sk************@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I would like to have DHTML on my DataList so that when I hover over a

cell,
it will change colors. I can't find a way to get onMouseOver into the
generated <td> from a DataList. There must be way to do this.... I

am just
missing it I suppose.

Anyone know?

Thanks,
Steve



Nov 18 '05 #4
That doesn't work either. This is odd. I don't see what I could be
missing.....

"Chris Bower" <ch***********@SPAMunionfedbank.com> wrote in message
news:e9**************@TK2MSFTNGP10.phx.gbl...
Hmm... Sounds like it should work. I don't know why it would make a
difference, but try not doing the .Add and just accessing the
AttributesCollection directly:
e.Item.Attributes("onMouseEnter","style.color = 'red'");
"Steve Klett" <sk************@yahoo.com> wrote in message
news:Of**************@TK2MSFTNGP11.phx.gbl...
Hi Chris,

Thanks for the reply.

Yeah, I found that I can use Attributes.Add() to do what I want. Weird
thing is... I have implemented it, but in the result HTML the attributes
aren't there. I've checked my schema, it's IE 5, so it's not that.

I've set a breakpoint in the DataBind event to see if it is actually

firing,
it is. I have added this code to add the attributes. I suspect that my
DHTML syntax is off, but I should at least see the bad syntax in the

result
HTML, but it's not there.
e.Item.Attributes.Add("onMouseEnter", "style.color = 'red'");

Any ideas?
"Chris Bower" <ch***********@SPAMunionfedbank.com> wrote in message
news:Ox*************@tk2msftngp13.phx.gbl...
I'm just guessing here (because I haven't tried it myself) but you might
try
handling the ItemCreated event and processing it there... Something
like this:

Protected Sub myDataList_ItemCreated(sender as object, e as eventargs)
handles myDataList.ItemCreated
If e.Item.Type = Item or e.Item.Type = AlternatingItem Then
dim myItem as DataListItem = CType(e.Item, DataListItem)
myItem.Attributes("onMouseOver") = "javascript:none;"
End If
End Sub

Keep in mind that I just typed this in my news client and not in the

IDE,
so
its not guaranteed to work, but it may give you some ideas.
"Steve Klett" <sk************@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
> I would like to have DHTML on my DataList so that when I hover over a cell,
> it will change colors. I can't find a way to get onMouseOver into the > generated <td> from a DataList. There must be way to do this.... I

am just
> missing it I suppose.
>
> Anyone know?
>
> Thanks,
> Steve
>
>



Nov 18 '05 #5
If I use a dataGrid, it works fine. I think with a DataList you can't
access the cell.... DataGrid exposes cells collection, then you can do it,
but not the DataList
"Steve Klett" <sk************@yahoo.com> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
That doesn't work either. This is odd. I don't see what I could be
missing.....

"Chris Bower" <ch***********@SPAMunionfedbank.com> wrote in message
news:e9**************@TK2MSFTNGP10.phx.gbl...
Hmm... Sounds like it should work. I don't know why it would make a
difference, but try not doing the .Add and just accessing the
AttributesCollection directly:
e.Item.Attributes("onMouseEnter","style.color = 'red'");
"Steve Klett" <sk************@yahoo.com> wrote in message
news:Of**************@TK2MSFTNGP11.phx.gbl...
Hi Chris,

Thanks for the reply.

Yeah, I found that I can use Attributes.Add() to do what I want. Weird thing is... I have implemented it, but in the result HTML the attributes aren't there. I've checked my schema, it's IE 5, so it's not that.

I've set a breakpoint in the DataBind event to see if it is actually firing,
it is. I have added this code to add the attributes. I suspect that my DHTML syntax is off, but I should at least see the bad syntax in the

result
HTML, but it's not there.
e.Item.Attributes.Add("onMouseEnter", "style.color = 'red'");

Any ideas?
"Chris Bower" <ch***********@SPAMunionfedbank.com> wrote in message
news:Ox*************@tk2msftngp13.phx.gbl...
> I'm just guessing here (because I haven't tried it myself) but you might try
> handling the ItemCreated event and processing it there... Something like > this:
>
> Protected Sub myDataList_ItemCreated(sender as object, e as eventargs) > handles myDataList.ItemCreated
> If e.Item.Type = Item or e.Item.Type = AlternatingItem Then
> dim myItem as DataListItem = CType(e.Item, DataListItem)
> myItem.Attributes("onMouseOver") = "javascript:none;"
> End If
> End Sub
>
> Keep in mind that I just typed this in my news client and not in the

IDE,
so
> its not guaranteed to work, but it may give you some ideas.
>
>
> "Steve Klett" <sk************@yahoo.com> wrote in message
> news:%2****************@TK2MSFTNGP09.phx.gbl...
> > I would like to have DHTML on my DataList so that when I hover
over a > cell,
> > it will change colors. I can't find a way to get onMouseOver into the > > generated <td> from a DataList. There must be way to do this....
I am
> just
> > missing it I suppose.
> >
> > Anyone know?
> >
> > Thanks,
> > Steve
> >
> >
>
>



Nov 18 '05 #6
Ahh, that makes sense. Odd though. Anyone from MS care to comment on why
that is?

"Steve Klett" <sk************@yahoo.com> wrote in message
news:Oi**************@TK2MSFTNGP12.phx.gbl...
If I use a dataGrid, it works fine. I think with a DataList you can't
access the cell.... DataGrid exposes cells collection, then you can do it, but not the DataList
"Steve Klett" <sk************@yahoo.com> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
That doesn't work either. This is odd. I don't see what I could be
missing.....

"Chris Bower" <ch***********@SPAMunionfedbank.com> wrote in message
news:e9**************@TK2MSFTNGP10.phx.gbl...
Hmm... Sounds like it should work. I don't know why it would make a
difference, but try not doing the .Add and just accessing the
AttributesCollection directly:
e.Item.Attributes("onMouseEnter","style.color = 'red'");
"Steve Klett" <sk************@yahoo.com> wrote in message
news:Of**************@TK2MSFTNGP11.phx.gbl...
> Hi Chris,
>
> Thanks for the reply.
>
> Yeah, I found that I can use Attributes.Add() to do what I want. Weird > thing is... I have implemented it, but in the result HTML the attributes > aren't there. I've checked my schema, it's IE 5, so it's not that.
>
> I've set a breakpoint in the DataBind event to see if it is actually
firing,
> it is. I have added this code to add the attributes. I suspect that
my
> DHTML syntax is off, but I should at least see the bad syntax in the
result
> HTML, but it's not there.
> e.Item.Attributes.Add("onMouseEnter", "style.color = 'red'");
>
>
>
> Any ideas?
> "Chris Bower" <ch***********@SPAMunionfedbank.com> wrote in message
> news:Ox*************@tk2msftngp13.phx.gbl...
> > I'm just guessing here (because I haven't tried it myself) but you might
> try
> > handling the ItemCreated event and processing it there...
Something
like
> > this:
> >
> > Protected Sub myDataList_ItemCreated(sender as object, e as eventargs) > > handles myDataList.ItemCreated
> > If e.Item.Type = Item or e.Item.Type = AlternatingItem Then
> > dim myItem as DataListItem = CType(e.Item, DataListItem)
> > myItem.Attributes("onMouseOver") = "javascript:none;"
> > End If
> > End Sub
> >
> > Keep in mind that I just typed this in my news client and not in
the IDE,
> so
> > its not guaranteed to work, but it may give you some ideas.
> >
> >
> > "Steve Klett" <sk************@yahoo.com> wrote in message
> > news:%2****************@TK2MSFTNGP09.phx.gbl...
> > > I would like to have DHTML on my DataList so that when I hover

over
a
> > cell,
> > > it will change colors. I can't find a way to get onMouseOver

into the
> > > generated <td> from a DataList. There must be way to do

this.... I am
> > just
> > > missing it I suppose.
> > >
> > > Anyone know?
> > >
> > > Thanks,
> > > Steve
> > >
> > >
> >
> >
>
>



Nov 18 '05 #7
I did this just to see if anything weird popped up
e.Item.Attributes.Add("onMouseEnter", "javascript:alert('test');");

IEnumerator iT = e.Item.Attributes.Keys.GetEnumerator();

while(iT.MoveNext())

{

Response.Write((string)iT.Current);

}
sure enough, the attributes are being added, just not rendered. Bummer.
Yeah, MS.. any word, suggestions, work arounds?

"Chris Bower" <ch***********@SPAMunionfedbank.com> wrote in message
news:uZ**************@TK2MSFTNGP09.phx.gbl...
Ahh, that makes sense. Odd though. Anyone from MS care to comment on why
that is?

"Steve Klett" <sk************@yahoo.com> wrote in message
news:Oi**************@TK2MSFTNGP12.phx.gbl...
If I use a dataGrid, it works fine. I think with a DataList you can't
access the cell.... DataGrid exposes cells collection, then you can do

it,
but not the DataList
"Steve Klett" <sk************@yahoo.com> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
That doesn't work either. This is odd. I don't see what I could be
missing.....

"Chris Bower" <ch***********@SPAMunionfedbank.com> wrote in message
news:e9**************@TK2MSFTNGP10.phx.gbl...
> Hmm... Sounds like it should work. I don't know why it would make a
> difference, but try not doing the .Add and just accessing the
> AttributesCollection directly:
> e.Item.Attributes("onMouseEnter","style.color = 'red'");
>
>
> "Steve Klett" <sk************@yahoo.com> wrote in message
> news:Of**************@TK2MSFTNGP11.phx.gbl...
> > Hi Chris,
> >
> > Thanks for the reply.
> >
> > Yeah, I found that I can use Attributes.Add() to do what I want.

Weird
> > thing is... I have implemented it, but in the result HTML the

attributes
> > aren't there. I've checked my schema, it's IE 5, so it's not that. > >
> > I've set a breakpoint in the DataBind event to see if it is actually > firing,
> > it is. I have added this code to add the attributes. I suspect that
my
> > DHTML syntax is off, but I should at least see the bad syntax in the > result
> > HTML, but it's not there.
> > e.Item.Attributes.Add("onMouseEnter", "style.color = 'red'");
> >
> >
> >
> > Any ideas?
> > "Chris Bower" <ch***********@SPAMunionfedbank.com> wrote in message > > news:Ox*************@tk2msftngp13.phx.gbl...
> > > I'm just guessing here (because I haven't tried it myself) but you might
> > try
> > > handling the ItemCreated event and processing it there...

Something like
> > > this:
> > >
> > > Protected Sub myDataList_ItemCreated(sender as object, e as

eventargs)
> > > handles myDataList.ItemCreated
> > > If e.Item.Type = Item or e.Item.Type = AlternatingItem Then
> > > dim myItem as DataListItem = CType(e.Item, DataListItem)
> > > myItem.Attributes("onMouseOver") = "javascript:none;"
> > > End If
> > > End Sub
> > >
> > > Keep in mind that I just typed this in my news client and not in the > IDE,
> > so
> > > its not guaranteed to work, but it may give you some ideas.
> > >
> > >
> > > "Steve Klett" <sk************@yahoo.com> wrote in message
> > > news:%2****************@TK2MSFTNGP09.phx.gbl...
> > > > I would like to have DHTML on my DataList so that when I hover

over
a
> > > cell,
> > > > it will change colors. I can't find a way to get onMouseOver into the
> > > > generated <td> from a DataList. There must be way to do

this....
I
> am
> > > just
> > > > missing it I suppose.
> > > >
> > > > Anyone know?
> > > >
> > > > Thanks,
> > > > Steve
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 18 '05 #8

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

Similar topics

0
by: Matt Adams | last post by:
I want to move the following <PRE> defintion to a css file: <TABLE><TR><TD><PRE>sample text</PRE></TD> <TD> not predefined font</TD></TR></TABLE> should be <TABLE><TR><TD class=aaa>sample...
2
by: js | last post by:
I have a table rendered with XSLT. The first column has a radio button controls for user to make a selection for a particular row. All the values in the remaining columns are all concated with a...
2
by: bissatch | last post by:
Hi, I am trying to use JavaScript to write a table column on a web page. The code is as follows: <html> <head> <script> function displaycount() {
3
by: RC | last post by:
I have a very sime html table like <html><head><title>My Table</title> <style> input { margin: 0; padding: 0; border-width: 0; text-indet: 0; text-align: left } </style></head><body> <table...
3
by: Henry Johnson | last post by:
Okay - I'm spinning my wheels on this one... can someone help me figure out how to programmatically populate a table cell as follows (from C# code-behind)? I've tried using a Literal control in the...
5
by: mahesr | last post by:
I want to match some particular text between <tr>and </tr> or <td>and </td>.... in PHP. like below............ <table><tr> CATEGORY: <td><font face="Verdana" size="1" color="#A000A0"> Wedding...
4
George Lft
by: George Lft | last post by:
I'm new at building table. Mostly PHP programming . Now I can't seem to fix the size of my table row and column. Any idea? <h4>Two rows and three columns:</h4> <table border="1"> <tr> ...
7
by: Xiaoyan | last post by:
Hi,everyone: I have a problem now. I can't get the information between the <tr><td> and </td></tr>. for example: I use this regular expression can't get it, I don't know why....
4
by: harryusa | last post by:
I am trying to center 2 images concentrically which are z-indexed to lay on top of each other making an image with a border from another image that has a transparent center. I need the images to be...
0
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.