Databinding with Ajaxcontroltoolkit Accordion in C#
How 开发者_如何学Gocan i Bind data in Accordian in C# .net
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();
}
From Simple Parent-Child data binding using Accordion
精彩评论