case0和1有什么区别吗?光看上面的代码看不出啊

解决方案 »

  1.   

    你用动态调试看mid=1时执行的那一句
      

  2.   

    是不是通过mid的不同值,加不同的控件
      

  3.   


    异常详细信息: System.IO.FileNotFoundException:
    源错误: 
    行 42: 
    行 43: 
    行 44:  Control c21 =LoadControl("~/1.ascx");
    行 45: 
    行 46:  PlaceHolder1.Controls.Add(c21);
     
      

  4.   

    就是通过mid的不同值动态加载不同的控件组合
      

  5.   

    public void BindData()
    {
    ArrayList tem=new ArrayList(); 
    int mid=0;
    //string [] tem;
    if(Request.QueryString["mid"]!=null)mid=Convert.ToInt32(Request.QueryString["mid"]);
    switch (mid)
    {
    case 0:

    tem.Add("~/1.ascx");
    tem.Add("~/2.ascx");
    Path = tem;
    break; case 1:

    tem.Add("~/1.ascx");
    tem.Add("~/3.ascx");
    Path = tem;
    break;


    }
    if (Path !=null)
    {

    for (int i=0;i<Path.Count;i++) 
    {
    Control c=LoadControl(Path[i].ToString());
    Pan.Controls.Add(c);
    Pan.Controls.Add(new LiteralControl("<br>")); }
    }






    }
    public ArrayList Path
    {
    get
    {
    object o = ViewState["Path"];
    return (ArrayList)ViewState["Path"];
    } set { ViewState["Path"] = value;}
    }