|
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
BindGridView();
}
private void BindGridView()
{
gvHoverDelay.DataSource = GetDataSource();
gvHoverDelay.DataBind();
}
private DataTable GetDataSource()
{
DataTable dTable = new DataTable();
DataRow dRow = null;
DateTime dTime;
Random rnd = new Random();
dTable.Columns.Add("Id", System.Type.GetType("System.Int32"));
dTable.Columns[0].AutoIncrement = true;
dTable.Columns.Add("RandomNo");
dTable.Columns.Add("Date");
dTable.Columns.Add("Time");
for (int n = 0; n < 10; ++n)
{
dRow = dTable.NewRow();
dTime = DateTime.Now;
dRow["RandomNo"] = rnd.NextDouble();
dRow["Date"] = dTime.ToString("MM/dd/yyyy");
dRow["Time"] = dTime.ToString("hh:mm:ss tt");
dTable.Rows.Add(dRow);
dTable.AcceptChanges();
}
return dTable;
}
protected void gvHoverDelay_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow && (e.Row.RowState == DataControlRowState.Normal || e.Row.RowState == DataControlRowState.Alternate))
{
string CurrentCSS = e.Row.RowState == DataControlRowState.Normal ? ((GridView)sender).RowStyle.CssClass : ((GridView)sender).AlternatingRowStyle.CssClass;
e.Row.Attributes["onmouseover"] = string.Format
(
"javascript:OnHoverDelay(this, '{0}', 'HoverDelay');",
CurrentCSS
);
e.Row.Attributes["onmouseout"] = "javascript:OffHoverDelay(this);";
e.Row.Attributes["onselectstart"] = "javascript:return false;";
e.Row.Attributes["onclick"] = "javascript:Click(this);";
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Samir NIGAM is a Microsoft Certified Professional. He is an insightful IT professional with results-driven comprehensive technical skill having rich, hands-on work experience n web-based applications using ASP.NET, C#, AJAX, Web Service, WCF, jQuery, Microsoft Enterprise Library , LINQ, MS Entity Framework, nHibernate, MS SQL Server & SSRS.
He has earned his master degree (MCA) from U.P. Technical University, Lucknow, INDIA, his post graduate dipoma (PGDCA ) from Institute of Engineering and Rural Technology, Allahabad, INDIA and his bachelor degree (BSc - Mathematics) from University of Allahabad, Allahabad, INDIA.
He has good knowledge of Object Oriented Programming, n-Tier Architecture, SOLID Principle, and Algorithm Analysis & Design as well as good command over cross-browser client side programming using JavaScript & jQuery,.
Awards: