dropdownlist data fetch
-
i have one dropdownlist suppose: ddl_Technologytype and a textbox: txt_technology. i have a database name: tech . and 2 tables in this database : tb_techtype and tb_ tech ddl_technology have some items , such as ASP,C, VB,JAVA.. and one item as OTHERS . Now the issue is that when i select the item OTHERS from ddl it shows the textbox ie txt_technology. and now i have to enter some text to the textbox. So, i will enter the text and then i will click submit button, at this time if the text that is entered in textbox is already present in the ddl then we have to show a message popup "Value is already present in the list" and if text in textbox is not present in ddl then should get added in ddl items when next time i open the page . and we have to use the database, and would also like to know the process without database . Please can anyone help me out since i am a beginner , i want solution from both using database and without database. Thank you.
-
i have one dropdownlist suppose: ddl_Technologytype and a textbox: txt_technology. i have a database name: tech . and 2 tables in this database : tb_techtype and tb_ tech ddl_technology have some items , such as ASP,C, VB,JAVA.. and one item as OTHERS . Now the issue is that when i select the item OTHERS from ddl it shows the textbox ie txt_technology. and now i have to enter some text to the textbox. So, i will enter the text and then i will click submit button, at this time if the text that is entered in textbox is already present in the ddl then we have to show a message popup "Value is already present in the list" and if text in textbox is not present in ddl then should get added in ddl items when next time i open the page . and we have to use the database, and would also like to know the process without database . Please can anyone help me out since i am a beginner , i want solution from both using database and without database. Thank you.
listen, if you can´t get an anser shortly i can tell you that later :doh:
-
listen, if you can´t get an anser shortly i can tell you that later :doh:
please nelson send the reply fast , if posible then by today . thank you
-
i have one dropdownlist suppose: ddl_Technologytype and a textbox: txt_technology. i have a database name: tech . and 2 tables in this database : tb_techtype and tb_ tech ddl_technology have some items , such as ASP,C, VB,JAVA.. and one item as OTHERS . Now the issue is that when i select the item OTHERS from ddl it shows the textbox ie txt_technology. and now i have to enter some text to the textbox. So, i will enter the text and then i will click submit button, at this time if the text that is entered in textbox is already present in the ddl then we have to show a message popup "Value is already present in the list" and if text in textbox is not present in ddl then should get added in ddl items when next time i open the page . and we have to use the database, and would also like to know the process without database . Please can anyone help me out since i am a beginner , i want solution from both using database and without database. Thank you.
listen, what you request it´s not hard, but it takes lots of time to code and debug!!! So, read the following and if you became stuck ask here in the forum anyone can help you there stay cool.:cool: (i assume you mean that dropdownlist = combobox) private void Form1_Load(object sender, EventArgs e) { textBox1.Visible = false; comboBox1.Items.Add("ASP"); //0 comboBox1.Items.Add("C#"); //1 comboBox1.Items.Add("VB"); //2 comboBox1.Items.Add("Javascript"); //3 comboBox1.Items.Add("PHP"); //4 comboBox1.Items.Add("Other"); //5 } private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { if (comboBox1.SelectedIndex == 5) { textBox1.Visible = true; } else { textBox1.Visible = false; } } private void button1_Click(object sender, EventArgs e) { comboBox1.Items.Add(textBox1.Text); } Try that easy exemple but that´s not enought! The solution without using a database doesn´t exist! How and where would you store the data from new values added to the textbox? And as you can see, each time you load your application your combox will only have the old values not the new added items. You noticed it already, right? What you have to do instead is this: create a table (if you don´t have one already) to fill up the combobox, so when you press button new values from the textbox will be added to the table. 1) create table tech with: id int, name varchar(50) id | name 1 | ASP 2 | c# 3 | VB 4 | HTML 5 | PHP 6 | C++ ...etc 2) create a SQL store procedure to fill up/load your combox (trigger it with a load_form event) SQL: create procedure tech_all as begin select id, name from dbo.tech end go C#: this is what i do to connect to database and fill combobox: string CONNECTION_STRING = "..."; // you know this SqlConnection con_sql = new SqlConnection(CONNECTION_STRING); SqlCommand cmd = new SqlCommand(); cmd.Connection = con_sql; cmd.CommandText = tech_all; // the store procedure above cmd.CommandType = CommandType.StoredProcedure; con_sql.Open(); SqlDataAdapter sql_da = new SqlDataAdapter(); sql_da.SelectCommand = cmd; DataTable dt = new DataTable(); sql_da.Fill(dt); con_sql.Close(); COMBOBOX1.DataSource = dt; COMBOBOX1.DisplayMember = "name"; // table tech variable COMBOBOX1.ValueMember = "id"; // table tech variable 3)create a SQL SP to add values to your combobox (trigger it with button_click event) SQL: create procedure tech_add @name as varchar(50) as begin insert into dbo.tec