473,811 Members | 3,737 Online
Bytes | Software Development & Data Engineering Community
+ 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 2556
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(obj ect sender,DataBind ItemEventArgs e)
{
(assuming the sno is in 0 location)
if e.item.iteminde x <> -1 then
e.item.cells(0) .text = e.item.iteminde x
( or
e.item.cells(0) .text= e.item.dataseti ndex +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(obj ect sender,DataBind ItemEventArgs e)
{
(assuming the sno is in 0 location)
if e.item.iteminde x <> -1 then
e.item.cells(0) .text = e.item.iteminde x
( or
e.item.cells(0) .text= e.item.dataseti ndex +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
1571
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 also be the key field. I am new to SQL and don't know how to do this. I am using SQL server 2000. Thanks for the help in advance. -S
1
1512
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 WMI. On Win9x, since it doesn't support WMI, I simply get the windows volume serial, although it's not as good. But now the problem is. The user needs to be admin in order to get those codes! If the software runs under a guess account, it...
29
3759
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 Firefox/1.0 I only ask because I believe I could use the same info as part of a scheme to generate a unique (or at least less common) serialized id code for the user's computer as part of a software locking and activation system. If I had a DLL...
8
7321
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 anyway to do that?
5
3828
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 column for a PK). If the file were smaller I would probably just use Excel to pop in a PK and then just load into the table... Since Excel chokes on files greater than 65k lines, this won't work.
1
4355
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 table with part numbers for a product. Each part number has a Serial Number starting with 0001 then 0002 etc... What i would like to happen is when an employee comes to a part number that they can automatically create 10 new records of Serial...
1
1548
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
1563
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 store char builder; :builder of item at the guitar store char type; :type of item at the guitar store char model; :model of item at the guitar store }guitar;
3
9208
swarnalaxmi
by: swarnalaxmi | last post by:
to display serial number for rows in gridview
0
9605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10651
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10405
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10136
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7671
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6893
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5697
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4342
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3871
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.