DropDownList DropDownList1=(DropDownList )ContentPlaceHolder1.FindControl("DropDownList1");
然后就可以用DropDownList1了

解决方案 »

  1.   

    if (!Page.IsPostBack)
    {
    string selItem = Request.QueryString["masterpage"];
    ListItem item = ((DropDownList)ContentPlaceHolder1.FindControl("DropDownList1")).Items.FindByValue(selItem);
    if (item != null)
    {
    item.Selected = true;
    }
    }
      

  2.   

    先试试不在模板页里能不能实现,感觉代码上没有问题,可能声明这个对象的代码没有自动生成,VS2005有时是会出现这个BUG.不过SP1补丁包,已经解决这个问题了.
      

  3.   

    我已经用SP1的,把代码放在.ASPX的<SCRIPT>块里是没有问题.