Bind the List Data to a DataGird Control

 protected override void CreateChildControls()  
        {  
            base.CreateChildControls();  
   
            SPWeb site = SPControl.GetContextWeb(Context);  
            SPList List = site.Lists["Personel"];  
            SPListItemCollection  Listitems = List.Items;  
            DataTable MyTable = Listitems.GetDataTable();  
   
            DataGrid MyGrid = new DataGrid();  
            MyGrid.DataSource = MyTable;  
            MyGrid.DataBind();  
            this.Controls.Add(MyGrid);   
        }  

Comments

Popular posts from this blog

SPSiteDataQuery to get data from multiple lists in site collection level in sharepoint 2013

Some of the Share Point Object Which I Practiced Till Now

My Interview Experience