How to use SqlDataSource for filling combobox as well as datatable or Dataset
        Posted  
        
            by Shantanu Gupta
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Shantanu Gupta
        
        
        
        Published on 2010-04-30T06:00:23Z
        Indexed on 
            2010/04/30
            11:27 UTC
        
        
        Read the original article
        Hit count: 219
        
I am trying to fetch a column value from a datasource when some value is selected from a dropdownlist on its change event.
                <asp:DropDownList ID="ddlCityName"  runat="server" DataSourceID="dsCity" 
                    DataTextField="CityName" DataValueField="CityID" AutoPostBack="True"
                    OnTextChanged="CityName_OnTextChanged">
                </asp:DropDownList>
                <asp:SqlDataSource ID="dsCity" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:GmapConnectionString %>" 
                    SelectCommand="SELECT * FROM [vcity]"
                    ></asp:SqlDataSource>
Here I want to fetch any other column's value that is not binded to a ddlCityName from sqldatasource.
I have four columns in datasource i.e. name, id, address, phno.
I want to fetch an address of a person who selects some value from ddl.
© Stack Overflow or respective owner