SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Sep 2005
    Posts
    189
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Javascript on datagrid item

    Hi, (me again-sorry!)

    I'm trying to implement a javascript onMouseOver event which will be linked to a hyperlink column in a datagrid. Basically I'd like like to apply change the background colour of an object 'myDiv_x' where x is the id of the column in the datagrid


    Code:
    void myDataGrid_ItemDataBound(Object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
    {
    	if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem )
    {
    	e.Item.Attributes("onmouseover") = "myDiv_" + thisItem + ".Color='#ff0000'";
    	e.Item.Attributes("onmouseout") = "myDiv_" +thisItem + ".Color='#00ff00'";
    }
    But I'm getting this error:
    'System.Web.UI.WebControls.WebControl.Attributes' denotes a 'property' where a 'method' was expected

    Any ideas?

  2. #2
    SitePoint Member
    Join Date
    Oct 2006
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    syntax error

    use square brackets instead of parenthesis

    e.Item.Attributes["onmouseover"] = ...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •