Reload DataGrid on DropDownList onChangeIndex

Discussion in 'ASP .Net Datagrid Control' started by hansiman, Feb 2, 2004.

  1. hansiman

    hansiman Guest

    I have a drop down list and a datagrid.
    The dropdownlist is populated on pageload.
    I' like to databind the datagrid when user selects in dropdownlist:

    Something like this:

    Private Sub cbo1_SelectedIndexChanged(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles cbo1.SelectedIndexChanged

    dgr.DataSource = GetDataSet(connection, _
    "SELECT * FROM Orders Where CustomerID = " _
    "'" & cbo1.SelectedItem.Value & "';")
    dgr.DataBind()
    End Sub


    If I add a button it works just fine.

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As _
    System.EventArgs) Handles Button1.Click
    dgr.DataSource = GetDataSet(connection, _
    "SELECT * FROM Orders Where CustomerID = " _
    "'" & cbo1.SelectedItem.Value & "';")
    dgr.DataBind()
    End Sub


    /morten
     
    hansiman, Feb 2, 2004
    #1
    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. hansiman
    Replies:
    2
    Views:
    1,870
    hansiman
    Feb 4, 2004
  2. Joshua Beall
    Replies:
    26
    Views:
    223,315
    AndreiKaa
    Jun 29, 2007
  3. gen_tricomi
    Replies:
    2
    Views:
    814
    gen_tricomi
    May 23, 2006
  4. DMS

    Need to reload datagrid on edit?

    DMS, Feb 2, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    118
  5. Stefan Mueller
    Replies:
    4
    Views:
    337
    Stefan Mueller
    Nov 5, 2005
Loading...

Share This Page