Hi I have a datagrid that is populated with a dataset. There is an extra template column that the datagrid has that I would like to populate programatically, but I'm not sure how to go about doing this. Here's my current code:
My new column is ItemNo and all I want to do is cycle through the records and give each record an item number starting at 1 and incrementing 1 for each record.
If anyone has any ideas, I'd be grateful.
Thanks
Code:
'this sub populates the data grid
Connection.Open()
'set the data adapter if it's not already been done
PrintItemsDataSet1.Clear()
PrintDataAdapter.SelectCommand.CommandText = _
"SELECT QuoteItems.SubHeading, QuoteItems.Qty, QuoteItems.PN, QuoteItems.Desc, " + _
"QuoteItems.LeadTime, QuoteItems.Optional, QuoteItems.Price, Quotes.ROE, " + _
"[Price]*[Roe] AS USDPrice, [Qty]*[USDPrice] AS TotalValue " + _
"FROM Quotes INNER JOIN QuoteItems ON Quotes.RecordID = QuoteItems.QuoteID " + _
"GROUP BY QuoteItems.SubHeading, QuoteItems.Qty, QuoteItems.PN, QuoteItems.Desc, " + _
"QuoteItems.LeadTime, QuoteItems.Optional, QuoteItems.Price, Quotes.ROE, " + _
"[Price]*[Roe], [Qty]*[USDPrice] " + _
"ORDER BY QuoteItems.SubHeading, QuoteItems.PN WHERE QuoteItems.QuoteID=" + quoteID
PrintDataAdapter.Fill(PrintItemsDataSet1, 0)
DataGrid.DataBind()
Connection.Close()
My new column is ItemNo and all I want to do is cycle through the records and give each record an item number starting at 1 and incrementing 1 for each record.
If anyone has any ideas, I'd be grateful.
Thanks