The above code will slow down the browser and the browser can hang when Rows in Grid will be 10000 or above.
Please view the below suggestion:
CS Code
protected void grvGroups_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onclick", "setGridValue('" + e.Row.ClientID + "')");
}
}
HTML Code
.sel
{
color: #303030;
font-size:3em;
font-weight:bold;
cursor:default;
}
.desel
{
color: #909090;
font-size:2em;
font-weight:normal;
cursor:pointer;
}
var oldro;
function setGridValue(ro)
{
var rs=document.getElementById(ro);
if(oldro!=null)
{
if(rs.className=="sel")
return;
oldro.className="desel";
}
rs.className="sel";
oldro=rs;
}
And forget then loop.
My name is Peeyush Shah and I am working with Microsoft.Net Framework at Jaipur, India with a Taxaction Software Development Company Named Professional Softec Pvt. Ltd.
My main focus is the development of online application.
We also develop custom software solutions for our customers and are able to support developers in using the following technologies, because we use them every day
- .NET Framework 2.0
- C#
- ASP.NET
- ASP.NET AJAX
- SQL Server 2005
- ADO .NET
- XML Webservices
- Payment systems
Feel free to take a look at the website and see Microsoft's new technologies in action