As the name implies, implementing EasyListBox is... well, easy. Consider the following code:
<ELB:EasyListBox id="myListBox" runat="server"
Width="250px" Height="300px" PromptText="Pick One!"
DataValueField="CategoryID"
DataTextField="CategoryName"
ConnectionStringSqlServer="connectionstring"
SelectQuery=" SELECT CategoryName, CategoryID FROM tblCategories b ORDER BY CategoryName"
/>
Notice the query and connection string built into the control tag, where "connectionstring" is the name of a key in the web.config file; explicit connection strings can also be used.
In ASP.NET 2.0, the new inline connection string syntax is available as well:
ConnectionStringSqlServer="<%$ ConnectionStrings:MyConnectionString %>"
If needed, standard ASP.NET databinding is available as well, by specifying the DataSource property and calling the DataBind method.
|