I got it working as shown below .
AjaxControlToolkit.Accordion grd = new AjaxControlToolkit.Accordion();
grd = (AjaxControlToolkit.Accordion)e.AccordionItem.FindControl("Accordion2");
TemplateBuilder head = new TemplateBuilder();
TemplateBuilder content = new TemplateBuilder();
if (myDataset.Tables[0].Rows.Count > 0)
{
grd.DataSource = myDataset.Tables[0].DefaultView;
grd.DataBind();
}
else
{
content.AllowWhitespaceLiterals();
content.AppendLiteralString("<b>Sorry no records Found!!!</b>");
AjaxControlToolkit.AccordionPane test = new AjaxControlToolkit.AccordionPane();
test.ID = "test";
test.Content = content;
grd.Panes.Add(test);
}
}
used template builder to create a new template with default content text set to "No records found". then applying this template to an dynamically created accordian pane and then adding this pane to the accordian present in the page