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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Gohil JayendrasinhPosted Mar 17, 2012, 8:43 AM
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
Mayur GujrathiPosted Mar 21, 2012, 4:32 AM
Jignesh TrivediPosted Mar 19, 2012, 5:33 AM
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.
SenthilkumarPosted Mar 17, 2012, 8:15 AM
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;
}
Satyapriya NayakPosted Mar 17, 2012, 6:37 AM
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
Gohil JayendrasinhPosted Mar 17, 2012, 6:35 AM
e.Row.Attributes.Add("style", "cursor: pointer");
If it's helpful for you then please check Accepted Asnwers