Handling NULLs in a DropDownList EditItemTemplate

  • Thread starter ForYourConsternation
  • Start date
F

ForYourConsternation

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>
 
F

ForYourConsternation

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.
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top