J
jason
Pardon the misguided NEWBIE question...
I have an aspx application that will create a table, populate it and
then I need to filter out select rows for binding into a datagrid.
The following code works, minus the attempt to filter (.select) the
dataset before binding. I know the select works as I can see it
selecting rows with a response.write, but apparenlty I don't know how
to bind selected datarows??
The design calls for loading from an array and ending up with
dataset/datatable. Yes - I could have skipped both the array and the
datatable and used regex to filter the collected data and a for loop
to load it into dropdown list - but not the point.
The below code is failing with:
System.Data.DataRow' does not contain a property with the name n4.
=========code
' create table
Dim dt As DataTable
Dim dr As DataRow
Dim i As Integer
dt = New DataTable
dt.Columns.Add(New DataColumn("n1", GetType(Integer)))
dt.Columns.Add(New DataColumn("n2", GetType(Integer)))
dt.Columns.Add(New DataColumn("n3", GetType(Integer)))
dt.Columns.Add(New DataColumn("n4", GetType(Integer)))
dt.Columns.Add(New DataColumn("n5", GetType(Integer)))
dt.Columns.Add(New DataColumn("n6", GetType(Integer)))
'move array to datatable
dim y as integer
dim x as integer
dim tot as integer
for y = 1 to 594 step 6
dr = dt.NewRow()
for x = 0 to 5
tot = x + y
dr(x) = colArrayList(tot)
next x
dt.Rows.Add(dr)
next y
'list full dataset and then filtered dataset
Dim foundRows As Datarow()
dlistfull.DataSource = dt
dlistfull.databind()
'selected rows
foundRows = dt.Select("n2 > 200")
dlist5.DataSource = foundRows
'the below lines telling me 'System.Data.DataRow' does not contain a
'property with the name n4.
dlist5.databind()
....
</script>
<form method="post" runat="server">
<asp:dropdownlist id="dlistfull" datavaluefield="n2" Runat="server"/>
<asp:dropdownlist id="dlist5" datavaluefield="n4" Runat="server"/>
</form>
Thanks for any help or information!
I have an aspx application that will create a table, populate it and
then I need to filter out select rows for binding into a datagrid.
The following code works, minus the attempt to filter (.select) the
dataset before binding. I know the select works as I can see it
selecting rows with a response.write, but apparenlty I don't know how
to bind selected datarows??
The design calls for loading from an array and ending up with
dataset/datatable. Yes - I could have skipped both the array and the
datatable and used regex to filter the collected data and a for loop
to load it into dropdown list - but not the point.
The below code is failing with:
System.Data.DataRow' does not contain a property with the name n4.
=========code
' create table
Dim dt As DataTable
Dim dr As DataRow
Dim i As Integer
dt = New DataTable
dt.Columns.Add(New DataColumn("n1", GetType(Integer)))
dt.Columns.Add(New DataColumn("n2", GetType(Integer)))
dt.Columns.Add(New DataColumn("n3", GetType(Integer)))
dt.Columns.Add(New DataColumn("n4", GetType(Integer)))
dt.Columns.Add(New DataColumn("n5", GetType(Integer)))
dt.Columns.Add(New DataColumn("n6", GetType(Integer)))
'move array to datatable
dim y as integer
dim x as integer
dim tot as integer
for y = 1 to 594 step 6
dr = dt.NewRow()
for x = 0 to 5
tot = x + y
dr(x) = colArrayList(tot)
next x
dt.Rows.Add(dr)
next y
'list full dataset and then filtered dataset
Dim foundRows As Datarow()
dlistfull.DataSource = dt
dlistfull.databind()
'selected rows
foundRows = dt.Select("n2 > 200")
dlist5.DataSource = foundRows
'the below lines telling me 'System.Data.DataRow' does not contain a
'property with the name n4.
dlist5.databind()
....
</script>
<form method="post" runat="server">
<asp:dropdownlist id="dlistfull" datavaluefield="n2" Runat="server"/>
<asp:dropdownlist id="dlist5" datavaluefield="n4" Runat="server"/>
</form>
Thanks for any help or information!