K
Kris Rudin
OK, I'm missing something obvious here...
I have a datagrid that I populate in the code-behind page thusly:
adptr = new OleDbDataAdapter("SELECT
RideDate,RideName,RideDescription,Distance,Duration,AvgMPH,MaxMPH,AvgHR,MaxH
R,Temperature as Temp, Conditions, Comments FROM RideInfo", dbConn);
cmdBldr = new OleDbCommandBuilder(adptr);
adptr.Fill(ds,"RideInfo");
dgRideList.DataSource = ds.Tables["RideInfo"].DefaultView;
dgRideList.DataBind();
But when I then try to access a column:
dgRideList.Columns[1].whatever - it says index out of range. If I do:
dgRideList.Columns.Count
I get 0. What's going on?
The grid displays correctly, but I can't seem to aceess a column
programmatically.
In my ASPX page I have only the grid control defined. No columns. Do I need
to explicitly define the columns? When I tried making bound columns there,
and using the above code, I got all the columns listed twice.
What am I not understanding, here?
Thanks!
I have a datagrid that I populate in the code-behind page thusly:
adptr = new OleDbDataAdapter("SELECT
RideDate,RideName,RideDescription,Distance,Duration,AvgMPH,MaxMPH,AvgHR,MaxH
R,Temperature as Temp, Conditions, Comments FROM RideInfo", dbConn);
cmdBldr = new OleDbCommandBuilder(adptr);
adptr.Fill(ds,"RideInfo");
dgRideList.DataSource = ds.Tables["RideInfo"].DefaultView;
dgRideList.DataBind();
But when I then try to access a column:
dgRideList.Columns[1].whatever - it says index out of range. If I do:
dgRideList.Columns.Count
I get 0. What's going on?
The grid displays correctly, but I can't seem to aceess a column
programmatically.
In my ASPX page I have only the grid control defined. No columns. Do I need
to explicitly define the columns? When I tried making bound columns there,
and using the above code, I got all the columns listed twice.
What am I not understanding, here?
Thanks!