473,404 Members | 2,179 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

filter & datagrid

sg
Hi

I'm starting programming in visual studio and c# and i have a problem
with filtering datagrid. I build form with datagrid and i see data from
database. I find in microsoft web page information how to create
filtering data grid but this doesn't work. What I must change? My form code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication10
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();

}

private void Form1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the
'minicrmDataSet1.adresy' table. You can move, or remove it, as needed.
this.adresyTableAdapter1.Fill(this.minicrmDataSet1 .adresy);
}

//from microsoft web page
private void MakeDataView()
{

DataView dv = new DataView();

dv.Table = minicrmDataSet1.Tables["adresy"];
dv.AllowDelete = true;
dv.AllowEdit = true;
dv.AllowNew = true;
dv.RowFilter = "imie = 'Berlin'";
dv.RowStateFilter = DataViewRowState.ModifiedCurrent;
dv.Sort = "imie DESC";

// Simple bind to a TextBox control
Text1.DataBindings.Add("Text", dv, "imie");
}
//

}
}

Thank you in advance for your help

Sebastian
Nov 21 '05 #1
1 8270
Hi,

"sg" <sg***@poczta.onet.pl> wrote in message
news:dl**********@news.onet.pl...
Hi

I'm starting programming in visual studio and c# and i have a problem with
filtering datagrid. I build form with datagrid and i see data from
database. I find in microsoft web page information how to create filtering
data grid but this doesn't work. What I must change? My form code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication10
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();

}

private void Form1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the
'minicrmDataSet1.adresy' table. You can move, or remove it, as needed.
this.adresyTableAdapter1.Fill(this.minicrmDataSet1 .adresy);
}

//from microsoft web page
private void MakeDataView()
{

DataView dv = new DataView();
I don't see you assign this new DataView to something and instead of
creating a new one, you can use the one BindingSource already uses:

DataView dv = (DataView)this.adresyBindingSource.List;

Any filtering on that DataView should be visible in the grid.
HTH,
Greetings

dv.Table = minicrmDataSet1.Tables["adresy"];
dv.AllowDelete = true;
dv.AllowEdit = true;
dv.AllowNew = true;
dv.RowFilter = "imie = 'Berlin'";
dv.RowStateFilter = DataViewRowState.ModifiedCurrent;
dv.Sort = "imie DESC";

// Simple bind to a TextBox control
Text1.DataBindings.Add("Text", dv, "imie");
}
//

}
}

Thank you in advance for your help

Sebastian

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Peter | last post by:
In this topic "Walkthrough: Using a DataGrid Web Control to Read and Write Data" updates/edits of a table are covered for all data and column(s). However no topic or section dedicated to explain...
1
by: Mike C | last post by:
I have a datagrid that outputs sales data like this: Customer Month Sales Acme Corp Jan 1,345 Acme Corp Feb 2,567 I'm trying to make it look like this: Customer ...
3
by: Dan V. | last post by:
How can I use real SQL on a DataTable? i.e. not array of rows using a filter... as in DataTable.Select. I read at : microsoft.public.dotnet.framework.adonet "As others have posted: There is no...
3
by: Pedor | last post by:
I want to display only data in the datagrid for specific records having a common or identical data in a column. How do you do this programmaticaly using combination of the datagrid object,...
1
by: RockNRoll | last post by:
I'm new to ASP.NET and need to filter a datagrid based on a textbox value. I have a working datagrid and would like the WHERE part of my SQL statement to call the value of a textbox and refresh...
2
by: AJ | last post by:
Hi all, An easy question! I have a datagrid that can needs to provide filter functionality. I have three controls above the grid (txtSearch,ddlSearchBy,btnSearch) btnSearch calls...
3
by: jason | last post by:
I'll try to explain in detail what it is I'm struggling with. I created a SQL database with one table called CallSheet which contains the following columns: Caller ID: <--Primary Key, auto...
9
by: thebison | last post by:
Hi all, I hope someone can help with this relatively simple problem. I am building a timesheet application using ASP.NET C# with Visual Studio 2003.As it is only a protoype application, my...
2
by: amir | last post by:
How can I filter my database in Multiple way, I mean that I wana to filter st. like this: sm* *th* *er Please Help me on this matter Amir
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.