Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
160
Loading a Dropdown using a stored procedure
posted

Hi,

 

I am trying populate a dropdown list on a webpage by using a store procedure. Basically when the SP is executed it will return the names of all of the active users in the database, which should then be populated into the ddl, its a basic get SP.

 

However i cannot figure out how to implement it with an infragisitcs dropdown. (i do have it working for a regular asp dropdown.)  ive tried this:

 

        WebDropDown1.DataSource = dataAccess.getUsers();;

WebDropDown1.TextField = "ProductName";

WebDropDown1.DataBind();

Where getUsers() is the SP. Any thoughts?


Parents
  • 14517
    Offline posted

    Hello,

    You can use and SqlDataSource:

            SqlDataSource sds = new SqlDataSource();
            sds.ConnectionString = myConnectionString;
            sds.SelectCommand="getUsers";
            sds.SelectCommandType = SqlDataSourceCommandType.StoredProcedure;

            WebDropDown1.DataSource = sds;
            WebDropDown1.TextField="ProductName";
            WebDropDown1.ValueField = "ProductName";

    Please let me know if you have any questions.

    Thanks,

    Valerie

     

     

Reply Children