DropDown in InsertItemTemplate in ListView

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?U2F0aGVlc2g=?=

    DropDown in InsertItemTemplate in ListView

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

    <InsertItemTemp late>

    <asp:DropDownLi st ID="DropDownLis t1" DataSource="<%# BindDept() %>"
    DataTextField=" DepartmentName" DataValueField= "DeptID" runat="server">

    </asp:DropDownLis t>

    </InsertItemTempl ate>

    CodeBehind:

    public IEnumerable BindDept()
    {

    EmployeeInfoDat aContext dbEmp = new EmployeeInfoDat aContext();
    var LINQQuery = from dept in dbEmp.Departmen ts

    select dept;return LINQQuery as IEnumerable;
    }



    Am i missing something?

Working...