Dear All
How to show hand sign on gridview row when control is there
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Gohil JayendrasinhRank #490 · 5K reputationPosted Mar 17, 2012, 4:43 AM EDT
I agree with Senthilkumar it'ss costly
So using jQuery you can also do this
$('[id*="GridViewList"] tr').addClass('gvcursor');
If it's helpful for you then please check Accepted Asnwers
Jignesh TrivediRank #16 · 50.3K reputationPosted Mar 19, 2012, 1:33 AM EDT
you can add Row Style using Serverside and client side,
Server Side : It is costly.
void CustomersGridView_RowCreated(Object sender, GridViewRowEventArgs e)
{
if(e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("style", "cursor: pointer");
}
Client Side :
runat="server">
....
....
hope this help.
Gohil JayendrasinhRank #490 · 5K reputationPosted Mar 17, 2012, 2:35 AM EDT
e.Row.Attributes.Add("style", "cursor: pointer");
If it's helpful for you then please check Accepted Asnwers
Satyapriya NayakRank #47 · 31.5K reputationPosted Mar 17, 2012, 2:37 AM EDT
Try this...
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Paging_in_GridView._Default" %>
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
namespace Paging_in_GridView
{
public partial class _Default : System.Web.UI.Page
{
string connStr = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
SqlCommand com;
SqlDataAdapter sqlda;
DataSet ds;
string str;
protected void Page_Load(object sender, EventArgs e)
{
bindgrid();
}
void bindgrid()
{
SqlConnection con = new SqlConnection(connStr);
con.Open();
str = "select * from employee";
com = new SqlCommand(str, con);
sqlda = new SqlDataAdapter(com);
ds = new DataSet();
sqlda.Fill(ds, "employee");
g1.DataMember = "employee";
g1.DataSource = ds;
g1.DataBind();
con.Close();
}
protected void g1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
g1.PageIndex = e.NewPageIndex;
bindgrid();
}
protected void g1_RowDataBound(object sender, GridViewRowEventArgs e)
{
e.Row.Attributes["style"] = "cursor:pointer";
}
}
}
Thanks
If this post helps you mark it as answer
SenthilkumarRank #387 · 6.5K reputationPosted Mar 17, 2012, 4:15 AM EDT
protected void GridView1_OnRowDataBound(object sender, GridViewRowEventArgs e)
If you have any css for the row style then you can add this css property along with the other style.
In the gridview tag you can include the attribute
RowStyle-CssClass="GridRowStyle"
.GridRowStyle
{
cursor:pointer;
}
Mayur GujrathiRank #666 · 3.6K reputationPosted Mar 21, 2012, 12:32 AM EDT