Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
2.33/5 (3 votes)
See more:
hi sir;

i want that when i click the search button the value are display or set in combo box. The values retrieved from database?
please solve my problem...

Thanks in advance...
Posted
Comments
ZurdoDev 20-Feb-13 16:31pm    
What do you have so far? Where are you stuck?
joshrduncan2012 20-Feb-13 16:33pm    
My +5.

1 solution

first of all you can try by your self , in which line your facing problem just ask that line alone directly you ask code means that's not good for you.

Any one give a code whatever you expect but you can't understand that logic .

Here what i'm trying to do is i have a textbox in that i enter some text and then click on search button then based upon the search the result to be displayed on DDL.

You write your SQL query
SQL
SELECT COL1,COL2,COL3 FROM TABLE1 WHERE COL1 LIKE '%searchedresult%'

C#
 protected void btnSearch_OnClick(object sender, EventArgs e)
    {
        Bind_Projects();
    }

protected void Bind_Projects()
    {
        string Search = txtSearch.Text.Trim();
        DataSet dsProj = //what do you want you fetch taht information                           
        ddlSearch.DataSource = dsProj;
        ddlSearch.DataTextField = "Proj_Description";
        ddlSearch.DataValueField = "Proj_Code";
        ddlSearch.DataBind();
        ddlSearch.Items.Insert(0, "---Select---");
    }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900