Click here to Skip to main content
15,923,120 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi every one.
I am new to SiteCore.


Please tell me how to get data from site core and bind it to asp gridview.

Thanks.
Posted

1 solution

Here, have a look at sample examples:
Sitecore 5.3: Using childlists as datasource[^]
New Technique For Databinding Sitecore Items[^]

Example #1:
C#
MultiListField seeMoreField = Sitecore.Context.Item.Fields["SeeMore"];
SeeMoreDataGrid.DataSource = seeMoreField.TargetIDs.Select( id => Sitecore.Context.Database.GetItem(id) );
SeeMoreDataGrid.DataBind();


Example #2:
C#
Sitecore.Data.Items.Item item = Sitecore.Context.Database.GetItem("/sitecore/content/home");
if (item != null)
  GridView.DataSource = item;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900