473,465 Members | 1,405 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

want to generate serial no. in datagrid

aspamit
38 New Member
I Am Displaying Data In Datagrid And I Want To Display Serial No. For Each Row.it Should Be Autogerated.

Pls Help.
It's Really Urgent.
Jan 25 '07 #1
2 2541
aaryan
82 New Member
I Am Displaying Data In Datagrid And I Want To Display Serial No. For Each Row.it Should Be Autogerated.

Pls Help.
It's Really Urgent.
hi aspamit,
we have to make use of the event OnItemDataBound to create a sno or autogenerate nos.
it includes the following steps:
step1: create a template column in the datagrid control
<asp: TemplateColumn HeaderText= "sno" ......
step2: For OnItemDataBound assign an event name that would fire when an item is databound to the datagrid
<asp: DataGrid id="Datagrid1" OnItemDataBound = "populatesno"....
step3: Write the code which would create the sno within the procedure populate sno
void populatesno(object sender,DataBindItemEventArgs e)
{
(assuming the sno is in 0 location)
if e.item.itemindex <> -1 then
e.item.cells(0).text = e.item.itemindex
( or
e.item.cells(0).text= e.item.datasetindex +1)
end if
hope this will solve your purpose.
good luck.
Jan 30 '07 #2
aspamit
38 New Member
hi aspamit,
we have to make use of the event OnItemDataBound to create a sno or autogenerate nos.
it includes the following steps:
step1: create a template column in the datagrid control
<asp: TemplateColumn HeaderText= "sno" ......
step2: For OnItemDataBound assign an event name that would fire when an item is databound to the datagrid
<asp: DataGrid id="Datagrid1" OnItemDataBound = "populatesno"....
step3: Write the code which would create the sno within the procedure populate sno
void populatesno(object sender,DataBindItemEventArgs e)
{
(assuming the sno is in 0 location)
if e.item.itemindex <> -1 then
e.item.cells(0).text = e.item.itemindex
( or
e.item.cells(0).text= e.item.datasetindex +1)
end if
hope this will solve your purpose.
good luck.
Thanks for ur help.
Feb 1 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Sumanth Suri | last post by:
Hi, I want to setup one of the fields in a table so it increments sequentially(int data type). i.e the first record should be record 1 and the second one should be 2 and so on. This field will...
1
by: Etienne | last post by:
Hi, in order to protect my software using web activation, I generate a computer hardware code. I'm using the motherboard serial and CPU serial, with ManagementObjectSearcher class. This relies on...
29
by: Lauren Wilson | last post by:
Does anyone know how the following info is extracted from the user's computer by a Front Page form? HTTP User Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107...
8
by: Hanson | last post by:
I have a datagrid control in an aspx page. The datagrid columns will be dynamically generated according to the pre-page's search condition, I want to hide some columns in the datagrid. is that...
5
by: Hunter Hillegas | last post by:
I have a CSV file with 400,000 lines of email mailing list information that I need to migrate to a new PostgreSQL database. Each line has all the info I need except a PK (I usually use an int4...
1
by: turtle | last post by:
I need to figure out a way to have a form add new records to a table based on a user defined qty and the last number used in the table for a specific part number. Let me explain better... i have...
1
by: imthiyas | last post by:
hai all, i would like to autogenerate serial number in datagrid... can anyone help me with this.. its too urgent .. plz with Regards, Imthiyas Ahamed.A
7
by: emre esirik(hacettepe computer science and enginee | last post by:
I used a structer in this program. typedef struct _guitar { int serial; :serial of item at the guitar store int price; :price of item at the guitar...
3
swarnalaxmi
by: swarnalaxmi | last post by:
to display serial number for rows in gridview
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.