title: How can I bind the data for an asp dropdown in a Telerik GridTemplateColumn
body: <p>I have this Telerik RadGrid</p>
  
  <pre><code>        &lt;telerik:RadGrid ID="gvMembers" runat="server"
          AutoGenerateColumns="false"
          OnNeedDataSource="gvMembers_NeedDataSource"
          AllowSorting="true"
          AllowPaging="true"
          PageSize="10"
          AllowAutomaticUpdates="true"
          AllowAutomaticInserts="true"
          AllowAutomaticDeletes="true"
          OnItemCreated="gvMembers_ItemCreated"
          OnItemInserted="gvMembers_ItemInserted"
          OnPreRender="gvMembers_PreRender"
          OnInsertCommand="gvMembers_InsertCommand"
          OnItemDataBound="gvMembers_ItemDataBound"
          OnUpdateCommand="gvMembers_UpdateCommand"
          OnDeleteCommand="gvMembers_DeleteCommand"
  
          &gt;
          &lt;HeaderStyle CssClass="GridHeader" /&gt;
          &lt;PagerStyle Mode="NextPrevNumericAndAdvanced" /&gt;
          &lt;MasterTableView AutoGenerateColumns="false" DataKeyNames="UserID" CommandItemDisplay="Top" InsertItemPageIndexAction="ShowItemOnCurrentPage"&gt;
              &lt;Columns&gt;
                  &lt;telerik:GridEditCommandColumn&gt;&lt;/telerik:GridEditCommandColumn&gt;
                  &lt;telerik:GridBoundColumn DataField="UserID" HeaderText="UserID" ReadOnly="true" UniqueName=""&gt;&lt;/telerik:GridBoundColumn&gt;
                  &lt;telerik:GridCheckBoxColumn DataField="Valid" HeaderText="Active" SortExpression="Valid" UniqueName="valid"&gt;&lt;/telerik:GridCheckBoxColumn&gt;
                  &lt;telerik:GridBoundColumn DataField="FirstName" HeaderText="First Name" SortExpression="FirstName" UniqueName="firstname"&gt;&lt;/telerik:GridBoundColumn&gt;
                  &lt;telerik:GridBoundColumn DataField="FirstName" HeaderText="Last Name" SortExpression="LastName" UniqueName="lastname"&gt;&lt;/telerik:GridBoundColumn&gt;
                  &lt;telerik:GridBoundColumn DataField="UserName" HeaderText="User Name" SortExpression="UserName" UniqueName="username"&gt;&lt;/telerik:GridBoundColumn&gt;
                  &lt;telerik:GridBoundColumn DataField="EmailAddress" HeaderText="Email" SortExpression="EmailAddress" UniqueName="email"&gt;&lt;/telerik:GridBoundColumn&gt;
  
                  &lt;telerik:GridTemplateColumn UniqueName="TemplateColumn" HeaderText="Role"&gt;
                      &lt;ItemTemplate&gt;
                          &lt;asp:Label ID="Label1" runat="server"
                              Text='&lt;%# DataBinder.Eval(Container.DataItem, "Role") %&gt;'&gt;
                          &lt;/asp:Label&gt;
                      &lt;/ItemTemplate&gt;
                      &lt;EditItemTemplate&gt;
                          &lt;asp:DropDownList ID="ddlRole" runat="server" DataTextField="Role1" DataValueField="RoleID"&gt;&lt;/asp:DropDownList&gt;
                      &lt;/EditItemTemplate&gt;
                  &lt;/telerik:GridTemplateColumn&gt;
                  &lt;telerik:GridButtonColumn ConfirmText="Delete this Member?" ConfirmDialogType="RadWindow"
                      ConfirmTitle="Delete" ButtonType="PushButton" Text="Delete" CommandName="Delete" /&gt;
              &lt;/Columns&gt;
          &lt;/MasterTableView&gt;
      &lt;/telerik:RadGrid&gt;
  </code></pre>
  
  <p>As you can see I have an ASP DropDownList for the users role.  I now need to bind the database Role table values to this dropdown list.</p>
  
  <p>I have tried using this code to accomplish this:</p>
  
  <pre><code>DropDownList ddl = (DropDownList)e.Item.FindControl("ddlRole");
  ddl.SelectedValue = (string)DataBinder.Eval(e.Item.DataItem, "Role1").ToString();
  </code></pre>
  
  <p>But I get a null exception error on the second line. When I inspect the value of the DropDownList ddl it shows as null. It looks like it is not finding the DropDownList with the ID=ddlRole.  Any suggestion on what the problem may be?</p>