pr_wainwright
asked on
AppendDataBoundItems Problem
Hi,
I have a DropDownList box configured as shown below. When my DetailsView is in Edit or Insert mode I only want the 4 list items listed below to appear. If I have AppendDataBoundItems set to true I get the list items multiple times from other records in the table (I guess). If I set AppendDataBoundItems to false I only get 1 item in the list (the same as the current record). How can I make it so that the list is always the 4 items only?.
<EditItemTemplate>
OnSelectedIndexChanged="dd lStandardN umber_Sele ctedIndexC hanged" Width="220px" AutoPostBack="True">
<asp:DropDownList ID="ddlStandardNumber" runat="server" AppendDataBoundItems="True "
DataSourceID="SqlDataSourc e1" DataTextField="StandardNum ber" DataValueField="StandardNu mber"
SelectedValue='<%# Bind("StandardNumber") %>' OnSelectedIndexChanged="dd lStandardN umber_Sele ctedIndexC hanged" Width="220px" AutoPostBack="True">
<asp:ListItem>BGA-ENG-INST -TS-0001</ asp:ListIt em>
<asp:ListItem>BGA-ENG-INST -TS-0003</ asp:ListIt em>
<asp:ListItem>BGA-ENG-ELEC -TS-0001</ asp:ListIt em>
<asp:ListItem>BGA-ENG-ELEC -TS-0002</ asp:ListIt em>
</asp:DropDownList>
</EditItemTemplate>
Any help appreciated.
Thanks
Paul.
I have a DropDownList box configured as shown below. When my DetailsView is in Edit or Insert mode I only want the 4 list items listed below to appear. If I have AppendDataBoundItems set to true I get the list items multiple times from other records in the table (I guess). If I set AppendDataBoundItems to false I only get 1 item in the list (the same as the current record). How can I make it so that the list is always the 4 items only?.
<EditItemTemplate>
OnSelectedIndexChanged="dd
<asp:DropDownList ID="ddlStandardNumber" runat="server" AppendDataBoundItems="True
DataSourceID="SqlDataSourc
SelectedValue='<%# Bind("StandardNumber") %>' OnSelectedIndexChanged="dd
<asp:ListItem>BGA-ENG-INST
<asp:ListItem>BGA-ENG-INST
<asp:ListItem>BGA-ENG-ELEC
<asp:ListItem>BGA-ENG-ELEC
</asp:DropDownList>
</EditItemTemplate>
Any help appreciated.
Thanks
Paul.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It's the SelectedValue='<%# Bind("StandardNumber") %>' that will link the field to the control. Just try removing the tags that NazoUK has commented.
ASKER
I am new to ASP.NET, If I don't databind will the table field be updated with the selected item from the list?. I must be mistaken at what databinding does.
Thanks
Paul.