passing the value of dropdownlist into gridview

Discussion in 'C Programming' started by PetroTiburcio, May 29, 2013.

  1. PetroTiburcio

    PetroTiburcio

    Joined:
    May 17, 2013
    Messages:
    7
    Likes Received:
    0
    Greetings everyone, I have a dropdownlist populated by my database, below is my code:

    Code (Text):
    <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="dsNames"
                    DataTextField="Name" DataValueField="Id">
                </asp:DropDownList>
                <asp:SqlDataSource ID="dsNames" runat="server"
                    ConnectionString="<%$ ConnectionStrings:dbProfilesConnectionString %>"
                    SelectCommand="SELECT Lname+', '+Fname AS Name,Id FROM tblProfile">
                </asp:SqlDataSource>
    Beside my Dropdownlist, I have a button and below I have a Gridview, what I want to achieve is whenever I select one of the name in my Dropdownlist, then when I click the button the name should be added in gridview. I am using asp.net with c#. Any help would be appreciated. Thanks in advance. God Bless :)
     
    PetroTiburcio, May 29, 2013
    #1
    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.