Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Changing grid view in asp.net and c#

Options
  • 05-04-2006 3:50pm
    #1
    Closed Accounts Posts: 29


    Hi,
    I have a created a grid view for a small web app that I am doing and binded the data to a the entire field of the table in question and when the app is ran it displays all the fields in the table. I then have a check box that allows the user to select which fields they want to display in the gridview. So far I have tired changing the sqlcommand and the Gridview Datasource and DatasourceID but no good. The error that is returned is "A field or property with the name 'Quot_Sop' was not found on the selected data source." Where Quot_Sop is a field in the database.

    Below is my code
    SqlDataSource1.SelectCommand = "SELECT " + Parameters + " FROM Daily_DB";
    //GridView1.DataSourceID = "SqlDataSource1";
    //GridView1.DataSource = "SqlDataSource1";
    GridView1.DataBind();
    


Comments

  • Closed Accounts Posts: 4,943 ✭✭✭Mutant_Fruit


    Isn't there a .Visible property (i.e. Datagrid.columns[0].visible = false) which you can use to hide certain columns?


  • Closed Accounts Posts: 29 TowerMan


    Thanks, Mutant_Fruit taht worked out.


  • Closed Accounts Posts: 24 Phileas Fogg


    Post the HTML code for the gridview, you may have AutoGenerateColumns set to true or something.


Advertisement