dropdownlist in asp:gridview
With this code, it always inserts NULL in the "eier"-field when editing the record. (But the item's is showing in the dropdownlist as it should and everything else is okay):
<asp:TemplateField HeaderText="Eier" SortExpression="Eier">
<EditItemTemplate>
<asp:DropDownList ID="DropDownListBildeEier" runat="server" DataSourceID="SqlDataSourceEiernavn"
DataTextField="Eier" DataValueField="Eier" SelectedValue='<%# Bind("Eier") %>'></asp:DropDownList>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("Eier") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
And: If I put comment round the asp:DropDownList and remove the comment round the asp:TextBox, everything is working ok.
|