Solved

adding serial number column to datagrid

Posted on 2004-09-07
3
341 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
[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
3 Comments
 
LVL 4

Accepted Solution

by:
mrdilliard earned 50 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
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 …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

739 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