469,579 Members | 1,214 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,579 developers. It's quick & easy.

DataList <td onMouseOver>

I am trying to modify the onMouseOver attribute of a <td> cell created by a
DataList... according to

http://msdn.microsoft.com/library/de...classtopic.asp
"You can control the appearance of the DataGrid control by programmatically
adding attributes to the <td> and <tr> tags rendered by the control on the
browser. Attributes can be programmatically added by providing code in the
event handler for the OnItemCreated or OnItemDataBound event.
To add an attribute to the <td> tag, first get the TableCell object that
represents the cell in the DataGrid control you want to add the attribute
to. The Control.Controls collection for the Item property of the
DataGridItemEventArgs object passed into the event handler can be used to
get the desired TableCell object. You can then use the
AttributeCollection.Add method of the Attributes collection for the
TableCell object to add attributes to the <td> tag."
For the life of me, I cannot get the TableCell object that this page refers
to, can someone shed some light for me?
thnx
Nov 18 '05 #1
5 4537
In the OnItemCreated event of the datalist, you should be
able to reference e.Cells which through that heirarchy
should let you get a specific tablecell.

Also keep in mind, it looks like that article is speaking
about the datagrid specifically. I know some of the
lightweight record rending controls dont have all the same
events, or even the ability to acces e.DataItem from
databound/itemcreated events.

Weston Weems
-----Original Message-----
I am trying to modify the onMouseOver attribute of a <td> cell created by aDataList... according to

http://msdn.microsoft.com/library/default.asp? url=/library/en-
us/cpref/html/frlrfsystemwebuiwebcontrolsdatagridclasstopic
..asp

"You can control the appearance of the DataGrid control by programmaticallyadding attributes to the <td> and <tr> tags rendered by the control on thebrowser. Attributes can be programmatically added by providing code in theevent handler for the OnItemCreated or OnItemDataBound event.To add an attribute to the <td> tag, first get the TableCell object thatrepresents the cell in the DataGrid control you want to add the attributeto. The Control.Controls collection for the Item property of theDataGridItemEventArgs object passed into the event handler can be used toget the desired TableCell object. You can then use the
AttributeCollection.Add method of the Attributes collection for theTableCell object to add attributes to the <td> tag."
For the life of me, I cannot get the TableCell object that this page refersto, can someone shed some light for me?
thnx
.

Nov 18 '05 #2
No, it doesn't seem like you can access the e.Cells from the OnItemCreated
event.

any other ideas?
"Weston Weems" <an*******@discussions.microsoft.com> wrote in message
news:01****************************@phx.gbl...
In the OnItemCreated event of the datalist, you should be
able to reference e.Cells which through that heirarchy
should let you get a specific tablecell.

Also keep in mind, it looks like that article is speaking
about the datagrid specifically. I know some of the
lightweight record rending controls dont have all the same
events, or even the ability to acces e.DataItem from
databound/itemcreated events.

Weston Weems
-----Original Message-----
I am trying to modify the onMouseOver attribute of a <td>

cell created by a
DataList... according to

http://msdn.microsoft.com/library/default.asp?

url=/library/en-
us/cpref/html/frlrfsystemwebuiwebcontrolsdatagridclasstopic
.asp


"You can control the appearance of the DataGrid control

by programmatically
adding attributes to the <td> and <tr> tags rendered by

the control on the
browser. Attributes can be programmatically added by

providing code in the
event handler for the OnItemCreated or OnItemDataBound

event.
To add an attribute to the <td> tag, first get the

TableCell object that
represents the cell in the DataGrid control you want to

add the attribute
to. The Control.Controls collection for the Item property

of the
DataGridItemEventArgs object passed into the event

handler can be used to
get the desired TableCell object. You can then use the
AttributeCollection.Add method of the Attributes

collection for the
TableCell object to add attributes to the <td> tag."
For the life of me, I cannot get the TableCell object

that this page refers
to, can someone shed some light for me?
thnx
.

Nov 18 '05 #3
DataList is not made out of cells. DataGrid is. DataList items are defined
in ItemTemplate. You can navigate within DataListItem only if you know what
is in your ItemTemplate.

Eliyahu

"Ryan Moore" <ry*******@hotmail.com> wrote in message
news:Oh****************@TK2MSFTNGP15.phx.gbl...
No, it doesn't seem like you can access the e.Cells from the OnItemCreated
event.

any other ideas?
"Weston Weems" <an*******@discussions.microsoft.com> wrote in message
news:01****************************@phx.gbl...
In the OnItemCreated event of the datalist, you should be
able to reference e.Cells which through that heirarchy
should let you get a specific tablecell.

Also keep in mind, it looks like that article is speaking
about the datagrid specifically. I know some of the
lightweight record rending controls dont have all the same
events, or even the ability to acces e.DataItem from
databound/itemcreated events.

Weston Weems
-----Original Message-----
I am trying to modify the onMouseOver attribute of a <td>

cell created by a
DataList... according to

http://msdn.microsoft.com/library/default.asp?

url=/library/en-
us/cpref/html/frlrfsystemwebuiwebcontrolsdatagridclasstopic
.asp


"You can control the appearance of the DataGrid control

by programmatically
adding attributes to the <td> and <tr> tags rendered by

the control on the
browser. Attributes can be programmatically added by

providing code in the
event handler for the OnItemCreated or OnItemDataBound

event.
To add an attribute to the <td> tag, first get the

TableCell object that
represents the cell in the DataGrid control you want to

add the attribute
to. The Control.Controls collection for the Item property

of the
DataGridItemEventArgs object passed into the event

handler can be used to
get the desired TableCell object. You can then use the
AttributeCollection.Add method of the Attributes

collection for the
TableCell object to add attributes to the <td> tag."
For the life of me, I cannot get the TableCell object

that this page refers
to, can someone shed some light for me?
thnx
.


Nov 18 '05 #4
Yes, but the ItemTemplates ARE placed into TableCells... is there no way to
add an attribute to those cells?
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:OG**************@TK2MSFTNGP14.phx.gbl...
DataList is not made out of cells. DataGrid is. DataList items are defined
in ItemTemplate. You can navigate within DataListItem only if you know what is in your ItemTemplate.

Eliyahu

"Ryan Moore" <ry*******@hotmail.com> wrote in message
news:Oh****************@TK2MSFTNGP15.phx.gbl...
No, it doesn't seem like you can access the e.Cells from the OnItemCreated event.

any other ideas?
"Weston Weems" <an*******@discussions.microsoft.com> wrote in message
news:01****************************@phx.gbl...
In the OnItemCreated event of the datalist, you should be
able to reference e.Cells which through that heirarchy
should let you get a specific tablecell.

Also keep in mind, it looks like that article is speaking
about the datagrid specifically. I know some of the
lightweight record rending controls dont have all the same
events, or even the ability to acces e.DataItem from
databound/itemcreated events.

Weston Weems

>-----Original Message-----
>I am trying to modify the onMouseOver attribute of a <td>
cell created by a
>DataList... according to
>
>http://msdn.microsoft.com/library/default.asp?
url=/library/en-
us/cpref/html/frlrfsystemwebuiwebcontrolsdatagridclasstopic
.asp
>
>
>"You can control the appearance of the DataGrid control
by programmatically
>adding attributes to the <td> and <tr> tags rendered by
the control on the
>browser. Attributes can be programmatically added by
providing code in the
>event handler for the OnItemCreated or OnItemDataBound
event.
>To add an attribute to the <td> tag, first get the
TableCell object that
>represents the cell in the DataGrid control you want to
add the attribute
>to. The Control.Controls collection for the Item property
of the
>DataGridItemEventArgs object passed into the event
handler can be used to
>get the desired TableCell object. You can then use the
>AttributeCollection.Add method of the Attributes
collection for the
>TableCell object to add attributes to the <td> tag."
>
>
>For the life of me, I cannot get the TableCell object
that this page refers
>to, can someone shed some light for me?
>thnx
>
>
>.
>



Nov 18 '05 #5
Try e.Item.Attributes["onmouseover"] = ...

Probably e.Item is the td you mean. Even if is it not, it should support
onmouseover event.

Eliyahu

"Ryan Moore" <ry*******@hotmail.com> wrote in message
news:e9****************@TK2MSFTNGP10.phx.gbl...
Yes, but the ItemTemplates ARE placed into TableCells... is there no way to add an attribute to those cells?
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:OG**************@TK2MSFTNGP14.phx.gbl...
DataList is not made out of cells. DataGrid is. DataList items are defined
in ItemTemplate. You can navigate within DataListItem only if you know

what
is in your ItemTemplate.

Eliyahu

"Ryan Moore" <ry*******@hotmail.com> wrote in message
news:Oh****************@TK2MSFTNGP15.phx.gbl...
No, it doesn't seem like you can access the e.Cells from the

OnItemCreated event.

any other ideas?
"Weston Weems" <an*******@discussions.microsoft.com> wrote in message
news:01****************************@phx.gbl...
> In the OnItemCreated event of the datalist, you should be
> able to reference e.Cells which through that heirarchy
> should let you get a specific tablecell.
>
> Also keep in mind, it looks like that article is speaking
> about the datagrid specifically. I know some of the
> lightweight record rending controls dont have all the same
> events, or even the ability to acces e.DataItem from
> databound/itemcreated events.
>
> Weston Weems
>
>
>
> >-----Original Message-----
> >I am trying to modify the onMouseOver attribute of a <td>
> cell created by a
> >DataList... according to
> >
> >http://msdn.microsoft.com/library/default.asp?
> url=/library/en-
> us/cpref/html/frlrfsystemwebuiwebcontrolsdatagridclasstopic
> .asp
> >
> >
> >"You can control the appearance of the DataGrid control
> by programmatically
> >adding attributes to the <td> and <tr> tags rendered by
> the control on the
> >browser. Attributes can be programmatically added by
> providing code in the
> >event handler for the OnItemCreated or OnItemDataBound
> event.
> >To add an attribute to the <td> tag, first get the
> TableCell object that
> >represents the cell in the DataGrid control you want to
> add the attribute
> >to. The Control.Controls collection for the Item property
> of the
> >DataGridItemEventArgs object passed into the event
> handler can be used to
> >get the desired TableCell object. You can then use the
> >AttributeCollection.Add method of the Attributes
> collection for the
> >TableCell object to add attributes to the <td> tag."
> >
> >
> >For the life of me, I cannot get the TableCell object
> that this page refers
> >to, can someone shed some light for me?
> >thnx
> >
> >
> >.
> >



Nov 18 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Steve Klett | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.