Handling NULLs in a DropDownList EditItemTemplate

Discussion in 'Microsoft 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. Advertisements

  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. Advertisements

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 (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. George Durzi

    DropDownList in EditItemTemplate

    George Durzi, Sep 27, 2004, in forum: Microsoft ASP .NET
    Replies:
    1
    Views:
    323
    George Durzi
    Sep 27, 2004
  2. mr2_93
    Replies:
    1
    Views:
    636
    mr2_93
    Oct 2, 2005
  3. tshad
    Replies:
    8
    Views:
    449
    tshad
    Oct 19, 2005
  4. Guest
    Replies:
    2
    Views:
    1,417
    Guest
    Mar 27, 2006
  5. WT
    Replies:
    2
    Views:
    1,946
  6. Guest
    Replies:
    0
    Views:
    533
    Guest
    Oct 11, 2006
  7. Steve Hershoff
    Replies:
    2
    Views:
    624
    Steve Hershoff
    Apr 11, 2007
  8. Jeff

    problem using DropDownList in EditItemTemplate

    Jeff, Nov 13, 2008, in forum: Microsoft ASP .NET
    Replies:
    0
    Views:
    205
Loading...