visalakshi
New member
- Joined
- May 17, 2006
- Messages
- 4
- Programming Experience
- Beginner
Hii have created a table with 2 columnsaccountname,processname i have created 2 dropdownlists controls in asp.net pagei could retrieve accountnames from database in the first dropdownlist but could not retrieve the corresponding processnames for accounts in to the second dropdownlistthe code is as followsprivate void Page_Load(object sender, System.EventArgs e) { if(!Page.IsPostBack) { con1= new SqlConnection(dsn); con1.Open(); string str2; str2="select AccountName from tblMaster"; SqlCommand cmd = new SqlCommand(str2,con1); dr=cmd.ExecuteReader(); dropdownaccount.DataSource=dr; dropdownaccount.DataTextField="AccountName"; dropdownaccount.DataBind(); } }private void dropdownaccount_SelectedIndexChanged(object sender, System.EventArgs e) { con1 = new SqlConnection(dsn); // DataSet ds1=new DataSet(); string str1; if(dropdownaccount.SelectedItem.Selected) { str1="select Process from tblMaster where AccountName='" +dropdownaccount.SelectedItem.Text+"' "; SqlDataAdapter da1 = new SqlDataAdapter(str1,con1); da1.Fill(ds1,"tblMaster"); dropdownprocess.DataSource=ds1.Tables[0]; dropdownprocess.DataBind(); } } }please can anyone help me in this