Hi Vaidas,
One feature requested often is a set of row numbers on the grid. Using
DataGrid's OnItemCreate event allows a sequential set of numbers to be added
to the grid as each row is rendered.
Add a template column as the first column of the grid. As each row is
rendered, the code behind the OnItemCreate event will update the text of
this column based on the row index from the dataset. Each row of the dataset
has an index property that can be used to compute the row number:
public void OnItemCreated(Object sender,
DataGridItemEventArgs e)
{
if(e.Item.ItemType ==ListItemType.Item ||
e.Item.ItemType ==ListItemType.AlternatingItem)
e.Item.Cells[0].Text=(e.Item.DataSetIndex+1).ToString();
}
Also check this which is in VB.NET which you may love to try.
http://authors.aspalliance.com/aldot...ownumbers.aspx
Hope this helps you.
Thanks
Raghavendra
"vaidas gudas" <va**********@rst.lt> wrote in message
news:%2******************@TK2MSFTNGP15.phx.gbl...
I want that on my web page in the data grid would be the column with the
row number.
Data grid get data from dataset, which get data from sql server.
In sql server it is not column ROWNUM like in Oracle, than I can't from
dataset show the row number in datagrid using method databind.
Maybe it is other way to show row number column by using datagrid.
I am programing in VB.NET
Thank