I have detailsView control which is in Edit mode by default.
Control is bound to SQL table. In the table there is field thumbsize which can only have following three values: 1, 2 or 3
I want to have dropdown which will show the current value of thumbsize field, and I want to be able to change value selecting different value in the dropdown list.
Notice that values in the dropdown are predefined to 1,2 and 3.
thanks.
Control is bound to SQL table. In the table there is field thumbsize which can only have following three values: 1, 2 or 3
I want to have dropdown which will show the current value of thumbsize field, and I want to be able to change value selecting different value in the dropdown list.
Notice that values in the dropdown are predefined to 1,2 and 3.
thanks.
Code:
<asp:DetailsView ID="DVOptions" runat="server"
AutoGenerateRows="False" DataKeyNames="pkID"
DataSourceID="SqlDSOptions" Height="50px"
DefaultMode="Edit">
<Fields>
<asp:BoundField DataField="pkID"
HeaderText="pkID" SortExpression="pkID" />
<asp:BoundField DataField="userID"
HeaderText="userID" SortExpression="userID" />
<asp:BoundField DataField="thumbs"
HeaderText="thumbs" SortExpression="thumbs" />
<asp:BoundField DataField="thumbsize"
HeaderText="thumbsize" SortExpression="thumbsize" />
<asp:TemplateField HeaderText="thumb size">
<EditItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server"
DataValueField='<%# Bind("thumbsize") %>'>
<asp:ListItem Value="1">1</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
<asp:ListItem Value="3">3</asp:ListItem>
</asp:DropDownList>
</EditItemTemplate>
</asp:TemplateField>
</Fields>
</asp:DetailsView>