gridview repeater 根据(分类id列出分类名)
gridview中
在cs里
 protected void GridViewData_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            int ClassId = (int)DataBinder.Eval(e.Row.DataItem, "ClassId");
            Cn1yw.Bll.Gq_Class bll = new Cn1yw.Bll.Gq_Class(); 
            string title = bll.GetModelByCache(ClassId, 1);//传classId修改你自己的
            if (title != null)
            {
                e.Row.Cells[1].Text = title; // 列从0开始cells[1]表示第二列 
            }
            else
            {
                e.Row.Cells[1].Text = "未知类型";
            }
        }
repeater 中
在aspx页面里
<%# CompanyName(Convert.ToInt32(Eval("Classid"))) %>
在cs里
    public string CompanyName(int classid)
    { 
     Cn1yw.Bll.Gq_Class bll = new Cn1yw.Bll.Gq_Class();//修改你自己的
     string companytitle = bll.GetModelByCache(classid, 1); //修改你自己的
     return companytitle;
    }
 
                    
                     
                    
                 
                    
                 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号