I have a DropDownList bounded with List of Items from the SqlDatasource. The List of Items in the DropDownList are bounded based on the following query 

> 
> SELECT COLUMN\_NAMES FROM INFORMATION\_SCHEMA.COLUMNS WHERE (TABLE\_NAME
>  = 'RESULT')
> 
> 
> 

**My Requirement:** How to assign Multiple Datatypes for those DropDownList Items i.e. Few indexes in the List of Items shall be grouped as Decimal Datatype and Few Indexes shall be grouped as Varchar , DateTime Dataypes.

I would like to generate Dynamic Web controls based on the Datatype of DDL input and the correspoinding DropDownList\_SelectedIndexChanged().
 My SQL query:

```
SELECT COLUMN_NAME, DATA_TYPE 
FROM INFORMATION_SCHEMA.COLUMNS 
WHERE TABLE_NAME='RESULT' group by DATA_TYPE,COLUMN_NAME

```

Output:

```
COLUMN_NAME  DATA_TYPE  

a            decimal
b            decimal
c            decimal
d            int
e            int
f            varchar
g            varchar
h            varchar
i            varchar
j            varchar

```

If a or b or c are selected from DDL i need to generate dynamic web controls uniquely for Decimal datatype SelectedIndexValue.

How to Proceed?

My aspx code:

```
<asp:Panel ID="Panel5" runat="server" Height="221px">
        <span style="font-size: 135%; font-family: Verdana; font-weight: bold"> Search Functionalities </span>
        <asp:DropDownList ID="DropDownList5" runat="server" DataSourceID="column_list_for_filter" DataTextField="All_Columns" DataValueField="All_Columns" OnSelectedIndexChanged ="DropDownList5_SelectedIndexChanged"  AutoPostBack="true">
        </asp:DropDownList>
        <asp:SqlDataSource ID="column_list_for_filter" runat="server" ConnectionString="<%$ ConnectionStrings:DatabaseConnectionString %>" SelectCommand="SELECT COLUMN_NAME 'All_Columns' FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='RESULT'  "></asp:SqlDataSource>
        <asp:Button ID="Button1" runat="server" Font-Bold="True" Font-Names="Arial" Font-Size="Small" OnClick="Button1_Click" Text="Search Flow Periods" Width="144px" />
        <asp:Table ID="dynamic_filter_table" runat="server" ToolTip="Results">
        </asp:Table>
</asp:Panel>

```

C# code:

```
  protected void DropDownList5_SelectedIndexChanged(object sender, EventArgs e)
     {
         if(DropDownList5.SelectedIndex.Equals(typeof(Decimal)))
         {
            createdynamiccontrols();
         }
         else if (DropDownList5.SelectedIndex.Equals(typeof(DateTime)))
         {
             //Create Unique Web Controls
         }

         else if (DropDownList5.SelectedIndex.Equals(typeof(Char)))
         {
             //Create Unique Web Controls
         }
     }

```