Monday, January 10, 2011
GridView Row Highlighting on Mouseover
void spgv_RowCreated(object sender, GridViewRowEventArgs e)
{
// only apply changes if its DataRow
if (e.Row.RowType == DataControlRowType.DataRow)
{
// when mouse is over the row, save original color to new attribute, and change it to highlight yellow color
e.Row.Attributes.Add("onmouseover",
"this.originalstyle=this.style.backgroundColor;this.style.backgroundColor='#EEEEEE';this.style.cursor='pointer'");
// when mouse leaves the row, change the bg color to its original value
e.Row.Attributes.Add("onmouseout",
"this.style.backgroundColor=this.originalstyle;this.style.cursor='default'");
// on click row, go to item detail
e.Row.Attributes.Add("onclick", "javascript:location.href='" + ((DataRowView)e.Row.DataItem).Row.ItemArray.GetValue(6) + "'");
}
}
Sunday, March 21, 2010
Sliding Javascript Menu using JQuery
Wednesday, December 16, 2009
Continue scrolling while mouseover - Silverlight
private System.Windows.Threading.DispatcherTimer _ScrollUpDispatcherTimer;
private System.Windows.Threading.DispatcherTimer _ScrolDownDispatcherTimer;
private void bNext_MouseEnter(object sender, MouseEventArgs e)
{
_ScrolDownDispatcherTimer = new System.Windows.Threading.DispatcherTimer();
_ScrolDownDispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 300);
_ScrolDownDispatcherTimer.Tick += new EventHandler(ScrollDown_Each_Tick);
_ScrolDownDispatcherTimer.Start();
}
private void bPrev_MouseEnter(object sender, MouseEventArgs e)
{
_ScrollUpDispatcherTimer = new System.Windows.Threading.DispatcherTimer();
_ScrollUpDispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 300);
_ScrollUpDispatcherTimer.Tick += new EventHandler(ScrollUp_Each_Tick);
_ScrollUpDispatcherTimer.Start();
}
public void ScrollUp_Each_Tick(object o, EventArgs sender)
{
//scroll-up function
}
public void ScrollDown_Each_Tick(object o, EventArgs sender)
{
//scroll-down function
}
private void bPrev_MouseLeave(object sender, MouseEventArgs e)
{
_ScrollUpDispatcherTimer.Stop();
}
private void bNext_MouseLeave(object sender, MouseEventArgs e)
{
_ScrolDownDispatcherTimer.Stop();
}
Remember to call the respective stop() functions in the scrolling functions if there is nothing more to scroll.