ok
now i am trying in the same page ie .aspx.cs
with reference to u r code
but i get error
[System.Web.Services.WebMethod]
public static List<Country> GetCountries()
{
string constr = "........";
conn = new SqlConnection();
conn.ConnectionString = constr;//
conn.Open();
string sql = "Select distinct city from table";
SqlDataAdapter da = new SqlDataAdapter(sql, conn);
DataTable dt = new DataTable();
da.Fill(dt);
string[] items = new string[] {
(dt.Rows.Count - 1)};
int i = 0;
foreach (DataRow dr in dt.Rows)
{
items.SetValue(dr["city"].ToString(), i);
i++;
}
return items;
}
public class Country
{
private string _name;
public string Name
{
get { return _name; }
set { _name = value; }
}
private string _id;
public string Id
{
get { return _id; }
set { _id = value; }
}
}