Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > BOOK: Beginning Visual C#
|
BOOK: Beginning Visual C#
This is the forum to discuss the Wrox book Beginning Visual C#, Revised Edition of Beginning C# for .NET v1.0 by Karli Watson, David Espinosa, Zach Greenvoss, Jacob Hammer Pedersen, Christian Nagel, Jon D. Reid, Matthew Reynolds, Morgan Skinner, Eric White; ISBN: 9780764543821
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Visual C# 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 September 10th, 2004, 04:36 PM
Authorized User
 
Join Date: Jul 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default Trouble using the DataView control !


I admit, some of my troubles are due to things like running SQL SERVER 7 when I need to be running SQL SERVER 2000. Thus I get problems I can't figure out on my own. That leads me to my next predicament. This seems like something I could solve myself... but 4 hours later....The prob: I have placed a dataview control on my form. I have already succesfully establised a control on my form for :sqlDataAdapter1,sqlConnection1, and a DataSet11. My form populates just fine with data from a table in the Pubs Database. So anyway, since I am a beginner trying to learn variuos approaches, I Decide to set the sort property for the dataview control to be the value - title ASC, (title is a column in my table, ASC is a sort directive). I figured this would sort my Rows in the table alphabetically. Instead nothing happens. I have also experimented with the RowFilter property, which as I understand it, is a way to narrow the number of rows that appear in a datagrid by the property criteria. Also no result! DO I need to be doing a refresh or something? Here is what my property settings are for my dataview control:
AllowDelete true
AllowEdit true
AllowNew true
ApplyDefaultSort false
Modifiers private
RowFilter no entry
RowStateFilter CurrentRows
Sort title
Table dataSet11.titles

Any ideas on this "simple" problem (I'm sure it will be)





Cmarek
__________________
Cmarek
 
Old July 20th, 2005, 01:36 PM
Authorized User
 
Join Date: Jul 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry to see no one ever replied to Cmarek's topic. I'm having the same problem. Here is my Page_Load.

private void Page_Load(object sender, System.EventArgs e)
{
  // Move the data from the database to the DataGrid
  sqlDataAdapter1.Fill(dsCustomers1,"Customers");

  // Create a dataview to filter the Customers table.
  DataView dvCustomers = new DataView
                (dsCustomers1.Tables["Customers"]);

  // Apply a sort to the dataview.
  dvCustomers.Sort = "ContactName";

  // Apply a filter to the dataview.
  dvCustomers.RowFilter = "Country = 'France'";

  // Show row count.
  Label1.Text = Convert.ToString(dvCustomers.Count);

  // Bind the results to the grid.
  dgCustomers.DataSource = dvCustomers;
  // Label1.Text = Convert.ToString(dgCustomers.DataSource);
  dgCustomers.DataBind();
}

Label1 shows the correct number of 11 for "France" rows, but I still get all Customers rows, and the grid is still not sorting by column ContactName.


When I uncomment and run "Label1.Text = Convert.ToString(dgCustomers.DataSource);", I get "System.Data.DataView". I don't know if this is an indication of a problem or not. I was expecting to see "dvCustomers".

Thanks for any help,

Sniffen





Similar Threads
Thread Thread Starter Forum Replies Last Post
dataview Yasho VB.NET 2002/2003 Basics 1 May 28th, 2007 03:40 AM
Trouble using the login control vskalyan BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 13 February 26th, 2007 02:59 AM
Trouble displaying Data Grid control bam1934 ASP.NET 1.0 and 1.1 Basics 4 May 25th, 2005 07:59 AM
making changes to dataview bluelaser VS.NET 2002/2003 0 September 20th, 2004 10:15 PM
DataView vivi C# 4 November 10th, 2003 01:15 AM





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