accessing a datarow's index ?
Hi There,
I want to know how I can access a datarow's index property instead of looping through it ? I am trying to generate a table control from a stored procedure and I would like to have more control regrding the placement of values inside the control.
Can someone help me out with the syntax please?
Sean - thank in advance for your answer
Dim dr As DataRow
For Each dc In ds.Tables(0).Columns
Dim trow As New TableRow()
Dim tcellcolname As New TableCell()
'To Display the Column Names
For Each dr In ds.Tables(0).Rows
tcellcolname.Controls.Add(New LiteralControl(dc.ColumnName.ToString))
Next
If Not dc.ColumnName = "ListingID" And Not dc.ColumnName = "model" And Not dc.ColumnName = "listprice" And Not dc.ColumnName = "descri" And Not dc.ColumnName = "manufacturer" And Not dc.ColumnName = "comments" And Not dc.ColumnName = "formname" And Not dc.ColumnName = "username" And Not dc.ColumnName = "lblquantity" And Not dc.ColumnName = "lbllistprice" And Not dc.ColumnName = "lblcomments" And Not dc.ColumnName = "lbllocation" And Not dc.ColumnName = "Location" Then
trow.Cells.Add(tcellcolname)
End if
'To Display the Column Data
For Each dr In ds.Tables(0).Rows
Dim tcellcoldata As New TableCell()
If Not dc.ColumnName = "ListingID" And Not dc.ColumnName = "model" And Not dc.ColumnName = "listprice" And Not dc.ColumnName = "descri" And Not dc.ColumnName = "manufacturer" And Not dc.ColumnName = "comments" And Not dc.ColumnName = "formname" And Not dc.ColumnName = "username" And Not dc.ColumnName = "lblquantity" And Not dc.ColumnName = "lbllistprice" And Not dc.ColumnName = "lblcomments" And Not dc.ColumnName = "lbllocation" And Not dc.ColumnName = "Location" Then
tcellcoldata.Controls.Add(New LiteralControl(dr(dc.ColumnName).ToString))
End if
trow.Cells.Add(tcellcoldata)
Next
If Not dc.ColumnName = "ListingID" And Not dc.ColumnName = "model" And Not dc.ColumnName = "listprice" And Not dc.ColumnName = "descri" And Not dc.ColumnName = "manufacturer" And Not dc.ColumnName = "comments" And Not dc.ColumnName = "formname" And Not dc.ColumnName = "username" And Not dc.ColumnName = "lblquantity" And Not dc.ColumnName = "lbllistprice" And Not dc.ColumnName = "lblcomments" And Not dc.ColumnName = "lbllocation" And Not dc.ColumnName = "Location" Then
Table1.Rows.Add(trow)
End if
Next