日期:2014-05-18  浏览次数:20464 次

初学者问题帮忙看看啊,急!!!!!!!!!!!!!!!!!!!!!!!分不够再加.
我创建了两个用户控件Top5BuildingsSaleAndHire和Top5BuildingsBuyAndForHouse
用户控件Top5BuildingsSaleAndHire的作用是在页面首次加载的时候调用javascript中的Building2GetHouse函数的把出售的房屋信息加载到前台中.并根据用户通过选择出售和出租[color=#FF0000][/color]的两个链接来动态在数据库中调出关于房屋出售和出租的信息并显示在页面上.
前台代码为: 
 <script type="text/javascript" >
  var xmlHttp;
  function Building2createXMLHttpRequest() 
  {
  if (window.ActiveXObject) 
  {
  xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  } 
  else if (window.XMLHttpRequest) 
  {
  xmlHttp = new XMLHttpRequest();
  }
  }  
  function Building2GetHouse(obj) 
  { 
  var ProvinceID=obj.id 
  //alert(obj.id);
  Building2createXMLHttpRequest(); 
  xmlHttp.onreadystatechange = Building2handleStateChange; 
  xmlHttp.open("GET", "?TradeModleID="+obj.id, true); 
  xmlHttp.send(null); 
  }  
  function Building2FirsLoad(obj) 
  {  
  Building2createXMLHttpRequest(); 
  xmlHttp.onreadystatechange = Building2handleStateChange; 
  xmlHttp.open("GET", "?TradeModleID="+obj, true); 
  xmlHttp.send(null); 
  }  
  function Building2handleStateChange() 
  {
  if(xmlHttp.readyState == 4) //0(未初始化);1(正在装载);2 (装载完毕);3 (交互中);4 (完成) 
  {
  if(xmlHttp.status == 200) //200(OK);404(not found)
  {
  document.getElementById("BuildingsSaleAndHire").innerHTML=xmlHttp.responseText;
  }
  }
  }
 </script>  
  <div class="div"> 楼房 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;     &nbsp;
  &nbsp; &nbsp; &nbsp;&nbsp; <a id="1" href="#" onclick="Building2GetHouse(this)">出售</a>
  <a id="2" href="#" onclick="Building2GetHouse(this)">出租</a>
  <a id="3" href="../CompanySite/MoreBuildingsSaleAndHire.aspx" class="more">更多..</a>
  </div>  
  <div id ="BuildingsSaleAndHire">
  &nbsp;</div>
后台代码为:
  public partial class SaleAndHire : System.Web.UI.UserControl
 {
  protected void Page_Load(object sender, EventArgs e)
  {
  if (!Page.IsPostBack)
  {
  this.Parent.Page.ClientScript.RegisterStartupScript(this.GetType(),                           "abc", "Building2FirsLoad(1);", true);//调用前台的javascript中的Building2FirsLoad函数来为页面首次加载时调出数据.
  if (TradeModleID != "")
  {
  GetHouseInfoByTradeModleID(TradeModleID);
  }
  }
  }
  #region property
  private string TradeModleID
  {
  get
  {
  if (Request["TradeModleID"