后台:  public List<string> text = new List<string>();
    public List<int> num=new List<int>();    protected void btn_pages_Click(object sender, EventArgs e)
    {
        com = new SqlCommand("select content,step from zwzt a inner join cvsession b on a.content=b.cvsessions and b.uid=" + cookies, con);
        con.Open();
        SqlDataReader red = com.ExecuteReader();
        while (red.Read())
        {
            num.Add(Convert.ToInt32(red["step"]));
     
        }
      
        con.Close();
}将num集合值给前台方法  <%#zwzt(num)%></td>后台zwzt方法:
 public string zwzt(List<int> nums)
    {
        string str="";
        int steps=0;
        con = new SqlConnection(strConnection);
        com = new SqlCommand("select count(step) from zwzt", con);
        con.Open();
        SqlDataReader red = com.ExecuteReader();
        while (red.Read())
        {
            steps =Convert.ToInt32(red[0]);
        }
        con.Close();
        int tem = 0;
        //foreach (int i in nums)
        //{
        //    Response.Write(i);
        //}
            for (int i = 1; i < steps; i++)
            {
               
                if (i < nums[i])
                {
                    str += "<div  style='float:left; border:0px red solid; width:16px;height:20px;background:url(../images/arrow_sp.png) -18px -29px'></div>";
                    if (steps <= 8)
                    {
                        str += "<div  style='float:left; border:0px red solid; margin-top:4px;padding:0px 28px; height:13px;background:url(../images/arrow_sp.png) 0px -85px'></div>";
                    }
                    else if (steps == 9)
                    {
                        str += "<div  style='float:left; border:0px red solid; margin-top:4px;padding:0px 24px; height:13px;background:url(../images/arrow_sp.png) 0px -85px'></div>";
                    }
                    else
                        str += "<div  style='float:left; border:0px red solid; margin-top:4px;padding:0px 21px; height:13px;background:url(../images/arrow_sp.png) 0px -85px'></div>";
                }
                else if (i == nums[i])
                {
                    str += "<div  style='float:left;margin-left:4px; border:0px red solid; width:23px;height:22px;background:url(../images/arrow_sp.png) 0px -54px'></div>";
                }
                else
                {
                    if (steps <= 8)
                    {
                        str += "<div  style='float:left;padding:0px 28px;margin-top:2px;height:13px;background:url(../images/arrow_sp.png) 0px -75px repeat-x'></div>";
                    }
                    else if (steps == 9)
                    {
                        str += "<div  style='float:left;padding:0px 24px;margin-top:2px;height:13px;background:url(../images/arrow_sp.png) 0px -75px repeat-x'></div>";
                    }
                    else
                        str += "<div  style='float:left;padding:0px 20px;margin-top:2px;height:13px;background:url(../images/arrow_sp.png) 0px -75px repeat-x'></div>";                    str += "<div  style='float:left; border:0px red solid; width:16px;height:20px;background:url(../images/arrow_sp.png) 3px -29px'></div>";
                }
            }
            return str;
    }索引超出范围