Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding a SerialNo column in DataGrid

Status
Not open for further replies.

ravula2000

IS-IT--Management
Mar 8, 2002
205
US
I want to add a Record No (Serial NO) column in the datagrid. I think may be I Can use Template column. But I don’t know how to use it.. Can some one explain me with the code.


Thanks
Srini
 
Is your serial number not in the database?

Are you wanting them to be able to enter in a serial number into the interface?

D'Arcy
 
if you are trying to add a number such as:

1 myFirstColumn mySecondColumn

and you want that number not to be pulled from the DB, then you will need to Create a template column:

Code:
<asp:TemplateColumn>
 <ItemTemplate>
  <asp:Label id=&quot;lblRecordNumber&quot; Runat=&quot;server&quot;></asp:Label>
 </ItemTemplate>
</asp:TemplateColumn>

and in your code behind you will have to change the label.text property value every time the DataGrid fills a row. You can do that from the DataGrid1_ItemCreated event.

hth

Daren J. Lahey
Just another computer guy...
FAQ183-874 contains &quot;Suggestions for Getting Quick and Appropriate Answers&quot; to your questions.
Support your forums TODAY!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top