[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details

Dynamically changing the .SelectCommand for a Sql Datasource

Asked by schwad in MS SQL Server, SQL Query Syntax, Programming for ASP.NET

Tags: asp.net, GridView, SqlDataSource

I am using Asp.net Studio 2005 (.net 2.0) and I get the following error when executing the .Databind method:

A field or property with the name 'Group_Size_ID' was not found on the selected data source.

 My code is shown below:

        query = GetQuery();
        SqlDataSource1.SelectCommand = query;
        grdAmc.DataBind();    //Error here
        grdAmc.AutoGenerateEditButton = true;
        grdAmc.AutoGenerateDeleteButton = true;
        grdAmc.Visible = true;

A field or property with the name 'Group_Size_ID' was not found on the selected data source.

Note:  This works w/o error when all the columns of the able are selected.
 
Related Solutions
Keywords: Dynamically changing the .SelectCom…
 
Loading Advertisement...
 
[+][-]11/04/09 02:29 PM, ID: 25744755Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/04/09 05:25 PM, ID: 25745963Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/05/09 04:41 AM, ID: 25748784Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/06/09 02:58 PM, ID: 25763813Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89 - Hierarchy / EE_QW_3_20080625