Datatable.select Datagrid displays all records always

Discussion in 'ASP .Net Web Controls' started by Bas, Sep 10, 2004.

  1. Bas

    Bas Guest

    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+"%'");

    }
     
    Bas, Sep 10, 2004
    #1
    1. Advertising

  2. Bas

    Bas Guest

    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" <@> schreef in bericht
    news:...
    > 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" <> wrote in message
    > news:41421b0f$0$150$...
    > > 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+"%'");
    > >
    > > }
    > >
    > >

    >
    >
     
    Bas, Sep 13, 2004
    #2
    1. Advertising

  3. Bas

    Bas Guest

    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" <@> schreef in bericht
    news:...
    > 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" <> wrote in message
    > news:41456a9f$0$153$...
    > > 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" <@> schreef in bericht
    > > news:...
    > >> 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" <> wrote in message
    > >> news:41421b0f$0$150$...
    > >> > 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+"%'");
    > >> >
    > >> > }
    > >> >
    > >> >
    > >>
    > >>

    > >
    > >

    >
    >
     
    Bas, Sep 13, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chumley Walrus
    Replies:
    1
    Views:
    12,234
    =?Utf-8?B?QnJpYW4gQnJvd24=?=
    Dec 16, 2004
  2. AAaron123

    window.open always displays the address

    AAaron123, Nov 23, 2008, in forum: ASP .Net
    Replies:
    5
    Views:
    540
    AAaron123
    Nov 25, 2008
  3. atse

    select all the duplicate records

    atse, Oct 15, 2003, in forum: ASP General
    Replies:
    9
    Views:
    141
  4. Matt
    Replies:
    2
    Views:
    228
    Roland Hall
    Jan 11, 2004
  5. Replies:
    3
    Views:
    706
    Anthony Jones
    Nov 2, 2006
Loading...

Share This Page