C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » ASP.NET »

show row number of gridview in VS2005,C#,Javascript


Posted Date: 26 Sep 2008      Posted By: jayakumar      Member Level: Gold     Points: 1   Responses: 2



hi to All!.

am having a gridview with large no of rows,so i added the gridview in to the panel,
now i want to show the number of records, like

while you MouseOver on the Row , i have to display the message like CurrentRecordNo/TotalRecordNo.

if you move the cursor/mouse to the next row of the gridview then it should change NextRecordNo/TotalRecordNo.

could anyone tell/suggest me on this,this is for web appln in C#,VS2005.

cOuld any one help me how to make the Headers of Gridview as Fixed,the datarows are being scrollable,as am adding the gridview in to the panel.





Responses

Author: Sidewinder2    26 Sep 2008Member Level: GoldRating: 2 out of 52 out of 5     Points: 6

hi,

to get the current row number

protected void Grid_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{

if (((e.Item.ItemType == ListItemType.Item)
|| (e.Item.ItemType == ListItemType.AlternatingItem)))
{




e.Item.Cells[1].Attributes.Add("style", "cursor:hand");

e.Item.Cells[1].Attributes.Add("onClick", "return show(this,'" + Grid.ClientID + "');");
}

}

show(obj,dg1)
{

var DG1 = document.getElementById(dg);

if(obj!=null)
{
var par=obj.parentNode;

while(par.nodeName.toLowerCase()!='tr')
{
par=par.parentNode;
}
var param = par.rowIndex;


var len = DG1.Rows.length;
alert("Current Record Number is "+param+"/ Total Record number is "+len);

return true;
}

return false;

}

}


from this code u will only get the message when u click on 2nd column in the datagird. so make the code as per ur requirement.

cheers!,
Myself



Author: jayakumar    27 Sep 2008Member Level: GoldRating: 2 out of 52 out of 5     Points: 1

thanks for ur response,i ll try and let you know if i face any doubt


Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : search within Dataset and Bind it GridView in C#
Previous : need code for sms
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use