DropDown in InsertItemTemplate in ListView

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,739
Latest member
Clint8040

Latest Threads

Top