Button click & filtering a GridView

Discussion in 'ASP .Net' started by Jokke, Apr 2, 2010.

  1. Jokke

    Jokke Guest


    * Click event doesn't fire?

    On clicking a button, my gridview should be filtered with the value typed in
    a textbox.

    It works, but only the second time you click the button. First click ->

    To be on the safe side, I already removed the button and put another one
    there (with other name), but the behavior still stands.

    I am a first timer in ASP.NET, so I must be missing something. I tried
    debugging, and the click event simply doesn't fire the first time you click
    the button... Please advise!

    the code is:

    Protected Sub btnFilterSupplName_Click(ByVal sender As Object, ByVal e
    As System.EventArgs) Handles btnFilterSupplName.Click
    SqlDataSource2.FilterExpression = "[SupplierName] LIKE '%" &
    Me.txtSearchSupplName.Text & "%'"
    End Sub

    * Selecting the first GridView record

    The GridView has a Select column, and a Details View control is bound to it
    If the textbox/button filtering yields results in the GridView, I would like
    the DetailsView to display the first record in the GridView, as if the user
    had clicked on the Select of the first GridView record.
    How can I do this?

    thank you for your help!
    Jokke, Apr 2, 2010
    1. Advertisements

  2. Can you post the code where you are telling the button about this event
    handler? For example, are you setting Click="btnFilterSupplName_Click" in
    the HTML markup or are you maybe doing this in a Page Load event, etc...
    James VanDyne, Apr 2, 2010
    1. Advertisements

  3. Jokke

    Jokke Guest

    It is the button click event alright.


    Actually happens with 2 buttons, on their respective click events...

    Thx for helping.

    Jokke, Apr 6, 2010
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.