FormFields for ASP.net <formField:dropDownList ... >

markup results

Basic

<formField:dropDownList ID="ffddlBlank" 
  runat="server" Title="Blank" />

Binding to Linq-to-SQL is a breeze using the defaults you set in your web.config

Linq-to-SQL (using defaults)

<formField:dropDownList ID="ffddlCategory" 
  runat="server" Title="Category" 
  L2STableName="category" />

You can specify a few more properties to get more control of the L2S binding

Linq-to-SQL (required)

<formField:dropDownList ID="ffddlUser" 
  runat="server" Title="User" Required="true" 
  L2STableName="_user" DataTextField="last_name" 
  DataValueField="_user_id" />

It can still be used with normal DataSources as well

SqlDataSource (required)

<formField:dropDownList ID="ffddlSDS" 
  runat="server" Title="Category" 
  DataSourceID="sds" Required="true"
  SelectedValue="pirate" />

© 2012 Stan Naspinski