DropDown in InsertItemTemplate in ListView

  • Thread starter Thread starter Satheesh
  • Start date Start date
S

Satheesh

Hi all,
When the below code executed it is not binding the Dropdownlist in
insertitemtemplate. But the same is binding the Dropdownlist in
EditItemTemplate. Also, when i use LINQDataSource in insertitemtemplate is
also binding but only if i do like below it is not working...

<InsertItemTemplate>

<asp:DropDownList ID="DropDownList1" DataSource="<%# BindDept() %>"
DataTextField="DepartmentName" DataValueField="DeptID" runat="server">

</asp:DropDownList>

</InsertItemTemplate>

CodeBehind:

public IEnumerable BindDept()
{

EmployeeInfoDataContext dbEmp = new EmployeeInfoDataContext();
var LINQQuery = from dept in dbEmp.Departments

select dept;return LINQQuery as IEnumerable;
}



Am i missing something?
 
Back
Top