Click here to Skip to main content
15,889,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi,
I have a text box and combobox in aspx page, I have a database with two columns say "Parent" And "Child",First the combobox should be empty when I enter the value in textbox it should load to database ,and the same value sholud be displayed in aspx combobox.this has continue as i go on entering the textbox value it has to come to combobox. And when i select the value from combobox and press submit it should display on the database "Child" column.
Can any one help me please........................
Posted
Comments
Shobana16 14-Dec-11 5:43am    
After you enter the values in textbox insert it into database table and reload the page.Then in page load get the values from that table,fill it in one ds,assign it to a combobox..Do this repeatedly, when enter text in textbox..

try using the OnTextChange event of the Textbox control to insert data in the database and populate the combobox by setting the SelectedValue property of the combobox.
 
Share this answer
 
1st you set the autopostback properity of a textbox to true.
ten u write the code for insert as well as fetching operation in TextChanged event


C#
protected void TextBox1_TextChanged(object sender, EventArgs e)
    {
      //here when you leave the mouse cursor out of textbox this event is triggred 
        //now you can insert the data into database using the insert statement 
     //after inserting write the select query to fetch the data now here by doing this you will get the updated database value then you can bind it to drop down

 DropDownList1.DataSource=//here you will fetch the data from data base and put in some DataTabel or DataSet then 

DropDownList1.DataTextField="Parent";

DropDownList1.DataBind();




    }



hope this will help you
 
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