Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 20th, 2003, 09:15 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 146
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to aadz5
Default Formattinga Grid

Guys,

at the moment I am populating a grid and diplaying it. I want to filter out some of the columns within the grid. Is therea way of doing this

Thanks

Adnan Arab

My Code is: -

private void GridDataFiller()
{
  //String sPath = "\\\\premfs3\\sites\\premium8\\adnanarab66\\databa se\\house.mdb";

  String strConnect = "Provider = Microsoft.Jet.OleDb.4.0; data source=\\\\premfs3\\sites\\premium8\\adnanarab66\\ database\\House.mdb;";
  OleDbConnection objConnection = new OleDbConnection(strConnect);

  String strShowDetails = "SELECT * FROM Houses";
  OleDbDataAdapter objAdapter = new OleDbDataAdapter(strShowDetails, objConnection);

  DataSet objDataSet = new DataSet();
  objAdapter.Fill(objDataSet, "dtHouses");

  DataView dvHouses = new DataView (objDataSet.Tables["dtHouses"]);
  dvHouses.RowFilter = strPriceFilter + " AND (" + strSmokingFilter + ")" + " AND (" + strHouseHoldFilter + ")";

  dgHouse.DataSource = dvHouses;
  dgHouse.DataBind();

}

__________________
Adz - Learning The J2EE Ways.
 
Old October 20th, 2003, 10:36 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

you can do that using several techniques. One would use the SELECT statement like this:

String strShowDetails = "SELECT id, smokes, houses FROM Houses";

Another way would be in your HTML section. Set AutoGenerateColumns="False" and in between datagrid tags put this:

<Columns>
                    <asp:BoundColumn DataField="ID" ReadOnly="True" Visible="False" />
                    <asp:BoundColumn DataField="smokes" ReadOnly="True" HeaderText="New Smokes" />
<asp:BoundColumn DataField="houses" ReadOnly="True" HeaderText="New houses" />

                </Columns>





Similar Threads
Thread Thread Starter Forum Replies Last Post
Grid priya_anthony Beginning VB 6 1 August 17th, 2007 05:04 PM
grid view MunishBhatia ASP.NET 2.0 Professional 2 June 5th, 2007 12:15 AM
grid view MunishBhatia ASP.NET 2.0 Professional 1 May 25th, 2007 07:26 AM
Which grid shall i use? - URGENT Kaustav VB Components 0 October 7th, 2005 12:45 PM
grid michaelw C# 2 September 9th, 2003 02:00 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.