How can i Bind data in Accordian in C# .net
A:
You use the property DataSource and set it to your Item List which you want to bind.
After that you need to call DataBind() have a look at Accordion Sample for Ajax Toolkit
- DataSource - The data source to use.
- DataBind() must be called.
- DataSourceID - The ID of the data source to use. DataMember - The member to bind to when using a DataSourceID
And here is an example
private void BindAccordion()
{
sql = "Select distinct Cus_Type from Customers";
SqlDataAdapter da = new SqlDataAdapter(sql, “YourConnectionString”);
DataTable dt = new DataTable();
da.Fill(dt);
Accordion1.DataSource = dt.DefaultView;
Accordion1.DataBind();
}
Filip Ekberg
2010-05-20 07:23:30
Actually I hav use <contentTemplate> in HTML but it didnt work.
Fly In SKY
2010-05-20 07:31:23
The content template is what is used when you Bind something, see the link I provided, you will have an answer there! Follow their example and you should be good to go.
Filip Ekberg
2010-05-20 07:37:56