Handling NULLs in a DropDownList EditItemTemplate

Discussion in 'ASP .Net' started by ForYourConsternation@yahoo.com, Jul 24, 2007.

  1. Guest

    I'm trying to accomplish the equivalent of the code below, but with a
    two-way data binding. GetReportsTo() will just return a default
    selection in the case of a NULL DB entry. I thought I could just
    replace Eval with Bind, but that gives me: "The name 'Bind' does not
    exist in the current context."

    Is it possible to do this in the control, or do I need to modify the
    DataSource?

    <EditItemTemplate>
    <asp:DropDownList ID="DropDownList2" runat="server"
    DataSourceID="SqlDataSource2" DataTextField="Name"
    DataValueField="EmployeeID"
    SelectedValue='<%# GetReportsTo(Eval("ReportsTo")) %>'
    AppendDataBoundItems="True">
    <asp:ListItem Selected="True" Value="0">(none)</
    asp:ListItem>
    </asp:DropDownList>
    </EditItemTemplate>
    , Jul 24, 2007
    #1
    1. Advertising

  2. Guest

    On Jul 24, 3:37 pm, wrote:
    > I'm trying to accomplish the equivalent of the code below, but with a
    > two-way data binding. GetReportsTo() will just return a default
    > selection in the case of a NULL DB entry. I thought I could just
    > replace Eval with Bind, but that gives me: "The name 'Bind' does not
    > exist in the current context."
    >
    > Is it possible to do this in the control, or do I need to modify the
    > DataSource?
    >
    > <EditItemTemplate>
    > <asp:DropDownList ID="DropDownList2" runat="server"
    > DataSourceID="SqlDataSource2" DataTextField="Name"
    > DataValueField="EmployeeID"
    > SelectedValue='<%# GetReportsTo(Eval("ReportsTo")) %>'
    > AppendDataBoundItems="True">
    > <asp:ListItem Selected="True" Value="0">(none)</
    > asp:ListItem>
    > </asp:DropDownList>
    > </EditItemTemplate>


    If this is just a stupid question, please say so. No one will reply
    to this question anywhere.
    , Jul 25, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. George Durzi

    DropDownList in EditItemTemplate

    George Durzi, Sep 27, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    8,461
    George Durzi
    Sep 27, 2004
  2. =?Utf-8?B?Tkg=?=
    Replies:
    2
    Views:
    29,284
    =?Utf-8?B?Tkg=?=
    Mar 27, 2006
  3. WT
    Replies:
    2
    Views:
    4,559
  4. =?Utf-8?B?ZGVuIDIwMDU=?=

    No Value: DropDownlist in EditItemTemplate Gridview Problem

    =?Utf-8?B?ZGVuIDIwMDU=?=, Oct 11, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    528
    =?Utf-8?B?ZGVuIDIwMDU=?=
    Oct 11, 2006
  5. Steve Hershoff
    Replies:
    2
    Views:
    804
    Steve Hershoff
    Apr 11, 2007
Loading...

Share This Page