Click here to Skip to main content
15,893,487 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,


I am using a nested ajax accordian control.

i.e First accordian controls and inside that the second accordian control and inside the second one there is a gridview.

How can i display a custom message like "no records found" if the datasource to second accordian contol(which is inside first accordian control) is null.

Is there any property like emptydatatext in the accordian as we have in gridview control.
Posted
Updated 29-Sep-11 20:36pm
v2

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
                {
                   
                    //head.AllowWhitespaceLiterals();
                    //head.AppendLiteralString("Sorry no records Found!!!");
                    content.AllowWhitespaceLiterals();
                    content.AppendLiteralString("<b>Sorry no records Found!!!</b>");

                    //Create the Pane and set the head and content to your templatebuilders 
                    AjaxControlToolkit.AccordionPane test = new AjaxControlToolkit.AccordionPane();
                    test.ID = "test";
                   // test.Header = head;
                    test.Content = content;

                    //Add Pane To Accordion 
                     grd.Panes.Add(test);

                }
                
                //Accordion2.DataSource = myDataset.Tables[0].DefaultView;
                //Accordion2.DataBind();
            }


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
 
Share this answer
 
v2
Hi,

At the time of binding uour data control just set the text in first accordian control.

Bind your datacontrol from back end in pageload method .

First check fetched data is empty or not.If empty set text in first accordian panel

I hope you understood what I said



All the Best
 
Share this answer
 
Comments
sujit0761 30-Sep-11 5:20am    
We cant set the accordian pane using simple sring, it throws an error.

But still i appreciate ur answer, thanks for ur help.
Muralikrishna8811 30-Sep-11 5:24am    
Sry I just gave you suggestion .

B'coz I didn't work on ajax control
Jquery is my DNA so I develop any UI in jquery

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