473,466 Members | 4,850 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 1316
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...
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
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...
1
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
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,...
0
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.