Hello I want to make a Cascading dropdown using Jquery for that i Write the following code in code file.
[WebMethod]
public static CountryDetails[] BindDatatoDropdown(string type )
{
DataTable dt = new DataTable();
List<CountryDetails> details = new List<CountryDetails>();
using (SqlConnection con = new SqlConnection(@"Data Source=KULDEEP\KDSHARMA;Initial Catalog=Rent;Integrated Security=True" ))
{
using (SqlCommand cmd = new SqlCommand("SELECT sno,type FROM @d", con))
{
cmd.Parameters.AddWithValue("@d", type.ToString());
con.Open();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dt);
foreach (DataRow dtrow in dt.Rows)
{
CountryDetails country = new CountryDetails();
country.CountryId = Convert.ToInt32(dtrow["sno"].ToString());
country.CountryName = dtrow["type"].ToString();
details.Add(country);
}
}
...
Go to the complete details ...