• Decrease Text SizeIncrease Text Size

How do i retrieve data from Centralpoint module and loop through records

Posted Date: 5/3/2023
    Printer Friendly Version   Email A Friend   Add This   Increase Text Size   Decrease Text Size
Load data from Centralpoint module into data table and loop over the data


string name = "NewsExample";
CpContent content = CpContent.GetCache(name, SystemFilterOptions.Enabled);

if (content == null)
{
	content = new CpContent(name, SystemFilterOptions.Enabled);
	content.AddRelation("News", "StartDate, EndDate, Title", "StartDate DESC ");
	content.InsertCache();
}

DataTable dt =  content.Relation("News");

foreach (DataRow dr in dt.Rows)
{
	lbRecords.Text += (string)dr["Title"] + "<br>";
	HttpContext.Current.Trace.Write(String.Format("Title: {0} StartDate: {1}", dr["Title"], dr["StartDate"]));
}

   



Keywords: retrieve data from the module, module



Related Taxonomy
  - How Do I?
  - Questions

Comments:

Be the first to leave a comment.
Please Login to post comments.