Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Changing grid view in asp.net and c#

  • 05-04-2006 03: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