DropDownList in data binding
Learn how to retrieve database data and bind it to a DropDownList.
The text of this article is not in this database — only its details are. The old site it was published on is gone, but the Internet Archive kept a copy: DropDownList in data binding


ashish chauhanPosted Sep 23, 2011, 10:50 PM EDT
hiiiiii rahul kumar thnks to help me i have one quetion that tell me about some code or some sites link they can help me to send the mobile sms using the asp.net application or send me mail my id [email protected] plssss help me i have try that but i cant sucess to send sms
tariPosted Nov 9, 2010, 8:54 AM EST
very usefull post tanksssssxxxx
Avi BirvatkarPosted Jul 14, 2010, 4:48 AM EDT
How to add or store Sub-menus to main menus in sql database and retrive from sql database ? let me explain, in above exmple, in dropdown box there is one main menu "Rahul". if want to add sub-menus to " Rahu " menu like 1)home 2)book 3)college. then what i need to do. how i add these submenus in sql database and retrive form database. please help me... my carrer depends on this project... please send me code as soon as posible
Ivan DianaeditedPosted Nov 16, 2008, 7:03 PM ESTEdited Nov 16, 2008, 7:12 PM EST
hi Raahul, i've tried the code u write to binding data from database to dropdownlist. but it don't show anything at the dropdownlist. it appears to error with the message "'cmbKabupaten' has a SelectedValue which is invalid because it does not exist in the list of items.\r\nParameter name: value" string. the code i write is shown below : protected void cmbPropinsi_SelectedIndexChanged(object sender, EventArgs e) { //cmbPropinsi is a dropdownlist which items has been listed manual (not from database) fillCmbKabupaten(); } private void fillCmbKabupaten() { //cmbKabupaten is a dropdownlist which items i tried to bind from database according to the selected item on cmbPropinsi cmbKabupaten.Text = String.Empty; try { DataSet ds1 = pendaftaranM.getKabupatenByPropName(cmbPropinsi.SelectedValue.ToString()); cmbKabupaten.DataSource = ds1; cmbKabupaten.DataTextField = "nama_kabupaten"; cmbKabupaten.DataBind(); } catch (System.Data.SqlClient.SqlException e1) { cmbKabupaten.Text = String.Empty + e1.Message; } catch (Exception e2) { cmbKabupaten.Text = String.Empty + e2.Message; } } the method getKabupatenByPropName is shown below : public DataSet getKabupatenByPropName(string nama_prop) { try { DataSet ds = new DataSet(); con.Open(); SqlCommand cmd = new SqlCommand("GetKabupatenByPropName", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@nama_prop", SqlDbType.VarChar, 50)); cmd.Parameters["@nama_prop"].Value = nama_prop; SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(ds, "REF_KABUPATEN"); return ds; } catch (SqlException ex) { throw new ApplicationException(ex.Message); } catch (Exception ex) { throw new ApplicationException(ex.Message); } finally { con.Close(); } } i used stored procedure here CREATE PROCEDURE GetKabupatenByPropName @nama_prop varchar(50) AS select kab.nama_kabupaten from ref_kabupaten kab, ref_propinsi prop where kab.kd_prop = prop.kd_prop and prop.nama_prop = @nama_prop please help me, i'm really stressout with this... please reply me ASAP thank u very much...
Surya GangwarPosted Mar 7, 2008, 7:41 AM EST
I have not user webservices. Can you tell me the complete procedure how we can create webservices and how we can subscribe them. Please, reply me ASAP.