Solved

get the last row OnItemDataBound in Datagrid

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video discusses moving either the default database or any database to a new volume.

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now