Solved

get the last row OnItemDataBound in Datagrid

Posted on 2003-12-10
2
394 Views
Last Modified: 2010-05-18
Hello,

How do i get the last row OnItemDataBound in Datagrid or atleast the number of rows OnItemDataBound in Datagrid?

thanks
Beulah
0
Comment
Question by:Beulah
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 5

Accepted Solution

by:
seeflat earned 100 total points
ID: 9918255
The answer depends on whether you have paging turned on or off.

If you have paging turned on, then it's simple:
if (e.Item.ItemIndex == dgCurrentFiles.PageSize - 1)
{
                // Do something.
      Response.Write("I am the last row.");
}

If you have paging turned off, then it's a little more difficult:
Assume you have the DataGrid bound to a standard DataSet, called dsDataSet with only one table.

if (e.Item.ItemIndex == dsDataSet.Tables[0].Rows.Count - 1)
{
                // Do something.
      Response.Write("I am the last row.");
}

HTH

0
 
LVL 5

Expert Comment

by:seeflat
ID: 9956758
Any reason why this is a grade of C? It answered your question and gave a working example.

Thanks
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question