can anybody give me any example how to add "AjaxControlToolkit . AccordionPane" to the ASP.NET Ajax Accordion Control.
the situation, in short, is that i need to fill up Categories Names in HEADERS and Lists of Sub Categories in the Contents of Accordion panel. So lots of headers and then clicking on a header would drop a list of its sub categories. i have all data stored
in sql server. and need to fill in C# source view(not in html design view)
To add AccordionPanes to the Accordion, please refer to this sample code:
Protected Sub AddDetailAccordion(ByVal parentAd As AjaxControlToolkit.Accordion)
For p = 0 To 1
Dim ap As New AjaxControlToolkit.AccordionPane
Dim aphead As New Label
aphead.Text = "This is the pane" & p.ToString
ap.HeaderContainer.Controls.Add(aphead)
Dim subAd As New AjaxControlToolkit.Accordion
subAd.ID = "subAcc"
subAd.HeaderCssClass = "accordionHeader"
subAd.ContentCssClass = "accordionContent"
subAd.RequireOpenedPane = "false"
subAd.FadeTransitions = "True"
subAd.SelectedIndex = "0"
subAd.SuppressHeaderPostbacks = "true"
subAd.FramesPerSecond = "40"
subAd.TransitionDuration = "250"
For i = 0 To 1
Dim subADP1 As New AjaxControlToolkit.AccordionPane
Dim head1 As New Label
head1.Text = "Head" & i.ToString
subADP1.HeaderContainer.Controls.Add(head1)
For j = 0 To 2
Dim content1 As New Label
content1.Text = "content" & j.ToString & "<br /> "
subADP1.ContentContainer.Controls.Add(content1)
Next
subAd.Panes.Add(subADP1)
Next
ap.ContentContainer.Controls.Add(subAd)
parentAd.Panes.Add(ap)
Next
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
AddDetailAccordion(MyAccordion)
End Sub
I hope this has resolved your issue. If there are any more questions do not hesitate to contact me.
Best regards,
Zhi-Qiang Ni
Microsoft Online Community Support
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as
Answer” if a marked post does not actually answer your question.
am i doing wrong or right.THANX anyways... the stuff im using is doing right with me instead the accodion uses to show me horizontal scroll when i drop a header to view sub categorie.. and sometimes show vertical too..
Hi Asif, I think scrollbar is your problem as of now. Remove div tag from your code and check if you are not getting the scroll bars. Let me know if the problem continues. Anand
Both of my sample and your solution are feasible, the different between them are that:
1. My sample code is to simply show the relationship between the Accordion and the AccordionPane, you may add loop through sub categories if you prefer.
2. You solution is to build the sub AccordionPane’s Head and Content directly by using a class which inherits the ITemplate interface.
If you need to add many sub panes to the Accordion and would like to write a code for refactoring, we recommend using your solution.
Otherwise, if you only add a few panes, please write your application by rewriting my code.
Best regards,
Zhi-Qiang Ni
Microsoft Online Community Support
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as
Answer” if a marked post does not actually answer your question.
Member
123 Points
100 Posts
Adding Panels ajax accordion
May 27, 2008 02:39 AM|AsifAshraf|LINK
can anybody give me any example how to add "AjaxControlToolkit . AccordionPane" to the ASP.NET Ajax Accordion Control.
the situation, in short, is that i need to fill up Categories Names in HEADERS and Lists of Sub Categories in the Contents of Accordion panel. So lots of headers and then clicking on a header would drop a list of its sub categories. i have all data stored in sql server. and need to fill in C# source view(not in html design view)
my accordion controls name is MyAccordion
guess something like MyAccordion.Panes.Add(
But WHATS NEXT?
and BRIEF example?
accordion onmouseover
All-Star
27946 Points
2939 Posts
Re: Adding Panels ajax accordion
May 27, 2008 04:00 AM|Zhi-Qiang Ni - MSFT|LINK
Hi Asif Ashraf,
To add AccordionPanes to the Accordion, please refer to this sample code:
I hope this has resolved your issue. If there are any more questions do not hesitate to contact me.Best regards,
Zhi-Qiang Ni
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as
Answer” if a marked post does not actually answer your question.
Member
123 Points
100 Posts
Re: Adding Panels ajax accordion
May 27, 2008 04:23 AM|AsifAshraf|LINK
hmm.. looking good..
anyhow i already got a solution.. can you tell me if its best or yours...
i created a class PaneTemplateItem like
//START CLASS
public class PaneTemplateItem : ITemplate
{
private string template;
public string Template
{
get
{
return template;
}
set
{
template = value;
}
}
public PaneTemplateItem(string temp)
{
template = temp;
}
public void InstantiateIn(Control container)
{
LiteralControl ltr = new LiteralControl(this.template);
container.Controls.Add(ltr);
}
}
//END Class
and using like this
//adding header
AjaxControlToolkit.AccordionPane pane = new AjaxControlToolkit.AccordionPane();
MyAccordion.Panes.Add(pane);
PaneTemplateItem header = new PaneTemplateItem(category.Name);
pane.Header = header;
//adding sub categories to the pane like
PaneTemplateItem body = new PaneTemplateItem(
"<div id=\"div\"><ul>"
);
//Loop through sub categories
foreach (SubCategories subCategory in subCategoryCollection)
{
body.Template += "<li><a href=\"#\">" + subCategory.Name + "</a></li>";
}
body.Template += "</ul></div>";
pane.Content = body;
Please suggest me which way should i use?
am i doing wrong or right.THANX anyways... the stuff im using is doing right with me instead the accodion uses to show me horizontal scroll when i drop a header to view sub categorie.. and sometimes show vertical too..
ANY IDEAS?
Thanks
None
0 Points
29 Posts
Re: Adding Panels ajax accordion
May 27, 2008 05:12 AM|anand.arjoshi|LINK
All-Star
27946 Points
2939 Posts
Re: Adding Panels ajax accordion
May 27, 2008 05:42 AM|Zhi-Qiang Ni - MSFT|LINK
Hi Asif Ashraf,
Both of my sample and your solution are feasible, the different between them are that:
1. My sample code is to simply show the relationship between the Accordion and the AccordionPane, you may add loop through sub categories if you prefer.
2. You solution is to build the sub AccordionPane’s Head and Content directly by using a class which inherits the ITemplate interface.
If you need to add many sub panes to the Accordion and would like to write a code for refactoring, we recommend using your solution.
Otherwise, if you only add a few panes, please write your application by rewriting my code.
Best regards,
Zhi-Qiang Ni
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as
Answer” if a marked post does not actually answer your question.
None
0 Points
16 Posts
Re: Adding Panels ajax accordion
Jan 23, 2014 11:26 AM|aspdotnetlearning|LINK
Please Refer this
http://aspdotnet-learning.blogspot.in/2013/09/explain-how-to-use-ajax-accordion-panel.html
and also below site you check all ajax control example in asp.net
http://aspdotnet-learning.blogspot.in/2014/01/ajax-control-examples-or-ajax-extenders.html
accordion onmouseover