Datatable.select Datagrid displays all records always

B

Bas

This is all the code, why doesn't it work? I have a datagrid that always
displays all records, even if I type a string in TextBox1. I also tried a
adoDbDataAdapter...

private void Page_Load(object sender, System.EventArgs e)

{

// Put user code to initialize the page here

odbcDataAdapter1.Fill(dataSet11);

if (!IsPostBack)

{

DataGrid1.DataBind();

}


}

private void Button1_Click(object sender, System.EventArgs e)

{

dataSet11.Tables["Alle_Adressen"].Select("Zoeknaam like
'"+TextBox1.Text+"%'");

}
 
B

Bas

Jared, thanks for your thoughts. However, I also tried a dataview already.
I've gone out and bought a asp 1.1 book, I will try some examples from that.
I used .NET 2.0 and that is much better in this repsect, I needed no code at
all to build my app. But my hosting party doesnot support 2.0 yet, so I had
to resort to 1.1.

Regards,
Bas.

Jared said:
If you are binding the selected row to the datagrid it should work. You may
want to look into using a dataview it has a row filter property that is more
what you are looking for.

Dim dv as New DataView(dataSet11)
dv.RowFilter = "Zoeknaam like '"+TextBox1.Text+"%'"
DataGrid1.DataBind()

My C# is pretty bad,

dataview dv = new dataview(dataSet11.Tables["Alle_Adressen"]);
dv.RowFilter = "Zoeknaam like '"+TextBox1.Text+"%'";
DataGrid1.DataBind();


Bas said:
This is all the code, why doesn't it work? I have a datagrid that always
displays all records, even if I type a string in TextBox1. I also tried a
adoDbDataAdapter...

private void Page_Load(object sender, System.EventArgs e)

{

// Put user code to initialize the page here

odbcDataAdapter1.Fill(dataSet11);

if (!IsPostBack)

{

DataGrid1.DataBind();

}


}

private void Button1_Click(object sender, System.EventArgs e)

{

dataSet11.Tables["Alle_Adressen"].Select("Zoeknaam like
'"+TextBox1.Text+"%'");

}
 
B

Bas

I am using the dataview and it works ok.
I still donot understadn what went wrong in my original app.
2.0 is still beta, I am investigating it and I think it is more productive
than 1.1. (I am coming from a Java background :)
Thanks again!
Bas.

Jared said:
A dataview isn't a 2.0 object, it has been around since the beginning, I use
it all the time to filter my datagrids.

http://authors.aspalliance.com/aldotnet/examples/rowfilterdoublegrid.aspx

2.0 is still beta, you shouldn't try to develop any production apps in it
unitl the release version is out.

Bas said:
Jared, thanks for your thoughts. However, I also tried a dataview already.
I've gone out and bought a asp 1.1 book, I will try some examples from
that.
I used .NET 2.0 and that is much better in this repsect, I needed no code
at
all to build my app. But my hosting party doesnot support 2.0 yet, so I
had
to resort to 1.1.

Regards,
Bas.

Jared said:
If you are binding the selected row to the datagrid it should work. You may
want to look into using a dataview it has a row filter property that is more
what you are looking for.

Dim dv as New DataView(dataSet11)
dv.RowFilter = "Zoeknaam like '"+TextBox1.Text+"%'"
DataGrid1.DataBind()

My C# is pretty bad,

dataview dv = new dataview(dataSet11.Tables["Alle_Adressen"]);
dv.RowFilter = "Zoeknaam like '"+TextBox1.Text+"%'";
DataGrid1.DataBind();


This is all the code, why doesn't it work? I have a datagrid that
always
displays all records, even if I type a string in TextBox1. I also
tried
a
adoDbDataAdapter...

private void Page_Load(object sender, System.EventArgs e)

{

// Put user code to initialize the page here

odbcDataAdapter1.Fill(dataSet11);

if (!IsPostBack)

{

DataGrid1.DataBind();

}


}

private void Button1_Click(object sender, System.EventArgs e)

{

dataSet11.Tables["Alle_Adressen"].Select("Zoeknaam like
'"+TextBox1.Text+"%'");

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top