muthukumar

muthukumar

  • NA
  • 0
  • 100.9k

three tier architecture

Jan 6 2014 4:33 AM
i use a registration form in that based on one ddl1 it generate another ddl2
 
my problem is i using these in three tier architecture i dont know how to bind the ddl2 based on ddl1 .selectedvalue
 
 
here is my code     1.DAL.cs,   2.BAL.cs     3.registration form .cs  
 
ddl ID="ddlstate"
 
 

1.DAL.cs 

public DataTable Bind_ddlCity()
{
try
{
con = new SqlConnection(s);
con.Open();
string qry = "select state, from cntryandstate where cntry ='" + dd + "'";
cmd = new SqlCommand(qry, con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
return dt;
}
catch
{
throw;
}
finally
{
cmd.Dispose();
con.Close();
con.Dispose();
}
}
 

 2.BAL.Cs

 
public DataTable Bind_ddlCity()
{
try
{
return obj.Bind_ddlCity();
}
catch
{
throw;
}
finally
{
//obj = null;
}
}
 
 

3 .registration form .cs

 
private void Bind_ddlCity()
{
DataTable ret;
ret = obj.Bind_ddlCity();
if (ret.Rows.Count != 0)
{
ddlstate.DataSource = ret;
ddlstate.DataTextField = "state";
ddlstate.DataValueField = "cntry";
ddlstate.DataBind();
}
 
 
 

Answers (1)