Casting object from Drop Down Into Nullable type

I have the following drop down in my aspx:\[code\]<aspx:DropDownListID="ddl1"runat="server"/>\[/code\]In the code-behind (C#), I want to retrieve the value from the DropDownList.I populated my dropdown as such:\[code\]ddl1.DataSource = LocationOfData;ddl1.DataBind();\[/code\]LocationOfData returns of type CustomType. EDIT: CustomType is an enum.I want to be able to accomplish the following:\[code\]CustomType? myvar = ddl1.Text\[/code\]In other words, create a nullable variable using my CustomType and set it equal to the variable from the drop down. But the type that I can only retrieve Text (String) from ddl1.
 
Back
Top