how to add drop down list in a detailview control

m_gena

New Member
How can I put a drop down list in a DetailView control? I have converted the field into template but having some issues when I add the drop down list, basically it is not binding the data into my table. I simply want to have some static data in the drop down but it should save it when I hit the Update button. I have the DetailView in a Edit mode. Thanks\[code\]<asp:DetailsView ID="DetailsView2" runat="server" AutoGenerateRows="False" BackColor="#CCCCCC" BorderColor="#999999" BorderStyle="Solid" BorderWidth="3px" CellPadding="4" CellSpacing="2" DataKeyNames="Post_ID" DataSourceID="MyDataSource" ForeColor="Black" Height="50px" Width="805px" DefaultMode="Edit"> <EditRowStyle BackColor="#FFFFCC" Font-Bold="True" ForeColor="#003366" BorderStyle="Groove" /> <Fields> <asp:BoundField DataField="Post_ID" HeaderText="ID" ReadOnly="True" SortExpression="Post_ID" /> <asp:TemplateField HeaderText="Category" SortExpression="CategoryList"> <EditItemTemplate> <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("CategoryList") %>' Height="20px" Width="250px"></asp:TextBox> </EditItemTemplate> <InsertItemTemplate> <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("CategoryList") %>' Height="20px" TextMode="MultiLine" Width="300px"></asp:TextBox> </InsertItemTemplate> <ItemTemplate> <asp:Label ID="Label2" runat="server" Text='<%# Bind("CategoryList") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField ShowHeader="False"> <EditItemTemplate> <asp:Button ID="Button1" runat="server" CausesValidation="True" CommandName="Update" Text="Update" /> &nbsp;<asp:Button ID="Button2" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" /> </EditItemTemplate> <ItemTemplate> <asp:Button ID="Button1" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit" /> </ItemTemplate> </asp:TemplateField> </Fields> <FooterStyle BackColor="#CCCCCC" /> <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" /> <InsertRowStyle BackColor="#FFFFCC" /> <PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left" /> <RowStyle BackColor="White" /> </asp:DetailsView> \[/code\]
 
Back
Top