Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

get the last row OnItemDataBound in Datagrid

Posted on 2003-12-10
2
Medium Priority
?
398 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 200 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

705 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