A
Arch
I have a datagrid with clickable rows. When a row is clicked, a button
column fires and takes my user to another page. My datagrid rows also
change text color with the onmouseover and onmouseout events.
Everything works great, but when my user clicks the back button to go
back to the page with the datagrid, the row they clicked on is still
highlighted unless my user passes the mouse over it again to trigger the
onmouseout event. It looks weird and I'm afraid it will confuse my users.
Is there a way to make an onclick event perform more than one function
at a time? I'd like it to not only trigger a button column, but also
turn the text color back to its original color - in other words, I'd
like my dopostback event to perform the onmouseout event as well as
trigger the button column.
Thanks for any help. Here is the sub I'm using to add the java:
Protected Sub DataGrid_ItemCreated(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs)
if e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem Then
e.Item.Attributes.Add("onmouseover", "this.style.color='blue'")
e.Item.Attributes.Add("onmouseout", "this.style.color='black'")
e.Item.Attributes.Add("onclick",
javascript:__doPostBack('dgrDataGrid$ctl" & _
(e.Item.ItemIndex.ToString() + 2) & _
"$ctl00','')")
end if
end sub
column fires and takes my user to another page. My datagrid rows also
change text color with the onmouseover and onmouseout events.
Everything works great, but when my user clicks the back button to go
back to the page with the datagrid, the row they clicked on is still
highlighted unless my user passes the mouse over it again to trigger the
onmouseout event. It looks weird and I'm afraid it will confuse my users.
Is there a way to make an onclick event perform more than one function
at a time? I'd like it to not only trigger a button column, but also
turn the text color back to its original color - in other words, I'd
like my dopostback event to perform the onmouseout event as well as
trigger the button column.
Thanks for any help. Here is the sub I'm using to add the java:
Protected Sub DataGrid_ItemCreated(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs)
if e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem Then
e.Item.Attributes.Add("onmouseover", "this.style.color='blue'")
e.Item.Attributes.Add("onmouseout", "this.style.color='black'")
e.Item.Attributes.Add("onclick",
javascript:__doPostBack('dgrDataGrid$ctl" & _
(e.Item.ItemIndex.ToString() + 2) & _
"$ctl00','')")
end if
end sub