There is datasource property of DropDownList/ListBox which you need to assign and after that you call DataBind method that will bind the data.
Example :
In this example we are using ddlProduct DropDownList control.
In which we are assigning DataTable as datasource. dtDataTable is a DataTable.
We can also use various datasource like collection of object , Linq object etc...
Example :
ddlProduct.DataSource = dtDataTable
ddlProduct.DataBind()
ddlProduct.DataBind()
In this example we are using ddlProduct DropDownList control.
In which we are assigning DataTable as datasource. dtDataTable is a DataTable.
We can also use various datasource like collection of object , Linq object etc...
No comments:
Post a Comment