新闻分类显示.

新闻分类显示._第1张图片 


              
               

              


              
               
                 
                

                
                 
                  
                  
                  
                  
                  
                  
                  
                 
                

               

                
                 
                  

                                                       
                                                            
                                                            
  <%# DataBinder.Eval(Container.DataItem, "Type")%>

                                                              
                                                                  
                                                                      
                                                                  
                                                              

                                                                            
                                                                                
                                                                                    " target="_blank">  <%# DataBinder.Eval(Container.DataItem, "[/"title/"]")%>

                                                                                 

                                                                            

                                                                      

                                                            
                                                       
                                                   

 

cs代码

protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {

BindPrinSubDll(DDLparent7, "select columntype from lawrule group by columntype", "select id,Columntype,(left(title,20)+'...') title from lawrule a where id in (select top 3 id from lawrule b where a.columntype=b.columntype  and b.tradetype='房产法规' order by b.id desc)  order by columntype , id desc", "columntype");

}

}

 

public void BindPrinSubDll(DataList ddl,string psql,string csql,string strfiled)
    {
        conn.Open();
        SqlDataAdapter cmd1 = new SqlDataAdapter(psql,conn);
        DataSet ds = new DataSet();
        cmd1.Fill(ds, "parentTable");
        SqlDataAdapter cmd2 = new SqlDataAdapter(csql,conn);
        cmd2.Fill(ds, "childTable");
        ds.Relations.Add("myrelation",
        ds.Tables["parentTable"].Columns[strfiled],
        ds.Tables["childTable"].Columns[strfiled]);
        // 绑定Authors到父Repeater
        ddl.DataSource = ds.Tables["parentTable"];
        ddl.DataBind();
        conn.Close();
    }

你可能感兴趣的:(新闻分类显示.)