日期:2011-07-06  浏览次数:20483 次

js 代码

function GetAreaList(res1,res2)
     {
         var CityID = res1.options[res1.selectedIndex].value;
         res2.length=0;
         var ds = Property_Default.GetArea(CityID).value;
         if(ds != null&& typeof(ds) == "object" && ds.Tables != null)
         {
            if(res1.selectedIndex != 0)
            {                
                for(var i=1; i<ds.Tables[0].Rows.length; i++)
                {
                    var name=ds.Tables[0].Rows[i].AreaName;
                    var id=ds.Tables[0].Rows[i].AreaID;
                    res2.options.add(new Option(name,id));
                }
            }
            else
            {
                res2.options.add(new Option("选择区域","0"));
            }
        }
     }

cs 代码

[AjaxPro.AjaxMethod]//获得区域数据
    public DataSet GetArea(int CityID)
    {
        string str = "select * from ktv_Area where CityID=" +  CityID;
        DataSet ds = DataBase.ExeSqlda(str);
        return ds;
    }

private DataSet GetData()
    {
        string str = "select * from property_City";
        DataSet ds = DataBase.ExeSqlda(str);
        return ds;
    }