Solved

get the last row OnItemDataBound in Datagrid

Posted on 2003-12-10
2
391 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
  • 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

786 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