nevergiveup01
Programmer
Hello, I have a details view that updates all fields except my dropdown list selection..is there an extra step I missed when adding a dropdown selection to a template in edit mode of the details view? My table is called tblServiceQuote which has a field called TypeID.. TypeID is a foreign key in tblServiceType..TblServiceType has TypeID and Type.. I set the dropdown list to pull typeID and type and only show type but bind Typid to tblServiceQuote..I have done this in many other clients but cant get it to work in ASP..this seems simple but yet it will not work for me? What am I missing? Below is my code..By the way I only know VB not C#..
<aspetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataKeyNames="QuoteID"
DataSourceID="SqlDataSource1" DefaultMode="Edit" Height="50px" Width="125px">
<Fields>
<asp:BoundField DataField="QuoteID" HeaderText="QuoteID" InsertVisible="False" ReadOnly="True"
SortExpression="QuoteID" />
<asp:BoundField DataField="QuoteDate" HeaderText="QuoteDate" SortExpression="QuoteDate" />
<asp:BoundField DataField="CustID" HeaderText="CustID" SortExpression="CustID" />
<asp:TemplateField HeaderText="TypeID" SortExpression="TypeID">
<EditItemTemplate>
<aspropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource2" AutoPostBack="True"
DataTextField="Type" DataValueField="TypeID">
</aspropDownList><asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:TestFeetConnectionString %>"
SelectCommand="SELECT * FROM [tblServiceType]"></asp:SqlDataSource>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("TypeID") %>'></asp:TextBox>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("TypeID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="ContactMethID" HeaderText="ContactMethID" SortExpression="ContactMethID" />
<asp:CheckBoxField DataField="Accepted" HeaderText="Accepted" SortExpression="Accepted" />
<asp:BoundField DataField="Comments" HeaderText="Comments" SortExpression="Comments" />
<asp:CommandField ShowEditButton="True" />
</Fields>
</aspetailsView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TestFeetConnectionString %>"
DeleteCommand="DELETE FROM [tblServiceQuote] WHERE [QuoteID] = @QuoteID" InsertCommand="INSERT INTO [tblServiceQuote] ([QuoteDate], [CustID], [TypeID], [ContactMethID], [Accepted], [Comments]) VALUES (@QuoteDate, @CustID, @TypeID, @ContactMethID, @Accepted, @Comments)"
SelectCommand="SELECT QuoteID, QuoteDate, CustID, TypeID, ContactMethID, Accepted, Comments FROM tblServiceQuote WHERE (QuoteDate = (SELECT MAX(QuoteDate) AS Expr1 FROM tblServiceQuote AS tblServiceQuote_1))"
UpdateCommand="UPDATE [tblServiceQuote] SET [QuoteDate] = @QuoteDate, [CustID] = @CustID, [TypeID] = @TypeID, [ContactMethID] = @ContactMethID, [Accepted] = @Accepted, [Comments] = @Comments WHERE [QuoteID] = @QuoteID">
<DeleteParameters>
<asparameter Name="QuoteID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asparameter Name="QuoteDate" Type="DateTime" />
<asparameter Name="CustID" Type="Int32" />
<asparameter Name="TypeID" Type="String" />
<asparameter Name="ContactMethID" Type="String" />
<asparameter Name="Accepted" Type="Boolean" />
<asparameter Name="Comments" Type="String" />
<asparameter Name="QuoteID" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asparameter Name="QuoteDate" Type="DateTime" />
<asparameter Name="CustID" Type="Int32" />
<asparameter Name="TypeID" Type="String" />
<asparameter Name="ContactMethID" Type="String" />
<asparameter Name="Accepted" Type="Boolean" />
<asparameter Name="Comments" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
<aspetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataKeyNames="QuoteID"
DataSourceID="SqlDataSource1" DefaultMode="Edit" Height="50px" Width="125px">
<Fields>
<asp:BoundField DataField="QuoteID" HeaderText="QuoteID" InsertVisible="False" ReadOnly="True"
SortExpression="QuoteID" />
<asp:BoundField DataField="QuoteDate" HeaderText="QuoteDate" SortExpression="QuoteDate" />
<asp:BoundField DataField="CustID" HeaderText="CustID" SortExpression="CustID" />
<asp:TemplateField HeaderText="TypeID" SortExpression="TypeID">
<EditItemTemplate>
<aspropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource2" AutoPostBack="True"
DataTextField="Type" DataValueField="TypeID">
</aspropDownList><asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:TestFeetConnectionString %>"
SelectCommand="SELECT * FROM [tblServiceType]"></asp:SqlDataSource>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("TypeID") %>'></asp:TextBox>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("TypeID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="ContactMethID" HeaderText="ContactMethID" SortExpression="ContactMethID" />
<asp:CheckBoxField DataField="Accepted" HeaderText="Accepted" SortExpression="Accepted" />
<asp:BoundField DataField="Comments" HeaderText="Comments" SortExpression="Comments" />
<asp:CommandField ShowEditButton="True" />
</Fields>
</aspetailsView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TestFeetConnectionString %>"
DeleteCommand="DELETE FROM [tblServiceQuote] WHERE [QuoteID] = @QuoteID" InsertCommand="INSERT INTO [tblServiceQuote] ([QuoteDate], [CustID], [TypeID], [ContactMethID], [Accepted], [Comments]) VALUES (@QuoteDate, @CustID, @TypeID, @ContactMethID, @Accepted, @Comments)"
SelectCommand="SELECT QuoteID, QuoteDate, CustID, TypeID, ContactMethID, Accepted, Comments FROM tblServiceQuote WHERE (QuoteDate = (SELECT MAX(QuoteDate) AS Expr1 FROM tblServiceQuote AS tblServiceQuote_1))"
UpdateCommand="UPDATE [tblServiceQuote] SET [QuoteDate] = @QuoteDate, [CustID] = @CustID, [TypeID] = @TypeID, [ContactMethID] = @ContactMethID, [Accepted] = @Accepted, [Comments] = @Comments WHERE [QuoteID] = @QuoteID">
<DeleteParameters>
<asparameter Name="QuoteID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asparameter Name="QuoteDate" Type="DateTime" />
<asparameter Name="CustID" Type="Int32" />
<asparameter Name="TypeID" Type="String" />
<asparameter Name="ContactMethID" Type="String" />
<asparameter Name="Accepted" Type="Boolean" />
<asparameter Name="Comments" Type="String" />
<asparameter Name="QuoteID" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asparameter Name="QuoteDate" Type="DateTime" />
<asparameter Name="CustID" Type="Int32" />
<asparameter Name="TypeID" Type="String" />
<asparameter Name="ContactMethID" Type="String" />
<asparameter Name="Accepted" Type="Boolean" />
<asparameter Name="Comments" Type="String" />
</InsertParameters>
</asp:SqlDataSource>