Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

adding serial number column to datagrid

Posted on 2004-09-07
3
Medium Priority
?
351 Views
Last Modified: 2008-03-03
hi

   I have a datagrid on a page. I want to add a serial no. column automatically to datagrid where the serial number count

depends on the total records in the datagrid.

anybody help me

thanks
sandeep
0
Comment
Question by:sandeep437
1 Comment
 
LVL 4

Accepted Solution

by:
mrdilliard earned 200 total points
ID: 12002156
Add this template column as the first column in your datagrid.
<asp:TemplateColumn>
  <ItemTemplate>
    <asp:Label id="lblCount" Runat="server"><%# GetCount() %></asp:Label>
  </ItemTemplate>
</asp:TemplateColumn>

add this to your code:
      Function GetCount() As Integer
            count = count + 1
            Return count
      End Function

Have fun!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

824 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