F
frankswildyearstom
Hello,
Q1- I know there are more efficient ways to do this ( with
SqlDatasource), but If DataSet contains two tables, I would think
DataMember property would enable us two choose the table to be
displayed:
GridView1.DataSource = ds;
GridView1.DataMember = "ds.Tables[0]";//exception
this.DataBind();
I do know we could instead try:
GridView1.DataSource = ds.Tables[0];
this.DataBind(); // works
Q2 – Unlike DataSourceID property, DataSource property can’t be set
declaratively (inside .aspx file).
Any idea why it would be a bad idea to enable setting DataSource
inside aspx file?
Q3 - GridView.DataKeyNames stores the names of the primary key fields
for the items displayed in a GridView control. So if we issue a select
statement, which populates GridView, I would expect that by the time
Selected event is raised, GridView would already create DataKey
objects and store primary key values in them.
But it doesn’t? Why - when SqlDataSource.Selected is fired, GridView
columns are already filled with data and so GridView shouldn’t have
any problems storing primary key values into DataKey objects?
thanx
Q1- I know there are more efficient ways to do this ( with
SqlDatasource), but If DataSet contains two tables, I would think
DataMember property would enable us two choose the table to be
displayed:
GridView1.DataSource = ds;
GridView1.DataMember = "ds.Tables[0]";//exception
this.DataBind();
I do know we could instead try:
GridView1.DataSource = ds.Tables[0];
this.DataBind(); // works
Q2 – Unlike DataSourceID property, DataSource property can’t be set
declaratively (inside .aspx file).
Any idea why it would be a bad idea to enable setting DataSource
inside aspx file?
Q3 - GridView.DataKeyNames stores the names of the primary key fields
for the items displayed in a GridView control. So if we issue a select
statement, which populates GridView, I would expect that by the time
Selected event is raised, GridView would already create DataKey
objects and store primary key values in them.
But it doesn’t? Why - when SqlDataSource.Selected is fired, GridView
columns are already filled with data and so GridView shouldn’t have
any problems storing primary key values into DataKey objects?
thanx