protected void gvShowlist_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
// Navigate Link
string script = String.Format("window.open('./Destination.aspx?t=tool&qs1={0}&qs2={1}','_self')", DataBinder.Eval(e.Row.DataItem, "QS1_Value"), DataBinder.Eval(e.Row.DataItem, "QS2_Value"));
e.Row.Attributes.Add("onclick", script);
// Highlight on Mouse Over
if (e.Row.RowState == DataControlRowState.Alternate)
{
e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#F9E5B6';this.style.cursor='pointer';");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#ffffff';");
}
else
{
e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#F9E5B6';this.style.cursor='pointer';");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#f1f3f6';");
}
}
}
Another Way with JQuery
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
// Navigate Link
string script = String.Format("window.open('./Destination.aspx?t=tool&qs1={0}&qs2={1}','_self')", DataBinder.Eval(e.Row.DataItem, "QS1_Value"), DataBinder.Eval(e.Row.DataItem, "QS2_Value"));
e.Row.Attributes.Add("onclick", script);
// Highlight on Mouse Over
if (e.Row.RowState == DataControlRowState.Alternate)
{
e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#F9E5B6';this.style.cursor='pointer';");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#ffffff';");
}
else
{
e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#F9E5B6';this.style.cursor='pointer';");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#f1f3f6';");
}
}
}
Another Way with JQuery
This is very helpful. Thanks :)
ReplyDelete