Drop Down Value is not saved in the table

jam000999

New Member
i am hoping that i can get some kind of help here today as i am struggling to find out why this is happening. I have drop down list in a detailview in Edit Mode so when category is selected from the drop down and i hit the update button; it does not save the category that was selected in my table. It shows a NULL value. Here is my code:ASPX Code:\[code\]<asp:DetailsView ID="DetailsView2" runat="server" OnDataBound="DV_DataBound" AutoGenerateRows="False" BackColor="#CCCCCC" BorderColor="#999999" BorderStyle="Solid" BorderWidth="3px" CellPadding="4" CellSpacing="2" DataKeyNames="Post_ID" DataSourceID="DetailsEntryView_DS" ForeColor="Black" Height="50px" Width="800px" DefaultMode="Edit"> <EditRowStyle BackColor="#FFFFCC" Font-Bold="True" ForeColor="#003366" BorderStyle="Groove" /> <Fields> <asp:BoundField DataField="Post_ID" HeaderText="RCA ID" ReadOnly="True" SortExpression="Post_ID" /> <asp:TemplateField HeaderText="Root Cause Category" SortExpression="Root_Cause_Category"> <EditItemTemplate> <asp:DropDownList ID="ddlCountry" runat="server" AppendDataBoundItems="True" AutoPostBack="True" DataSourceID="DD_DS" DataTextField="Root_Cause_Category" DataValueField="Root_Cause_Category" > </asp:DropDownList> <asp:SqlDataSource ID="DD_DS" runat="server" ConnectionString="<%$ ConnectionStrings:DSRConnectionString %>" SelectCommand="SELECT DISTINCT [Root_Cause_Category] FROM [RCA_Category_List]"> </asp:SqlDataSource> </EditItemTemplate>\[/code\]//Here is Code behind:\[code\] protected void DV_DataBound(object sender, EventArgs e) { if (DetailsView2.CurrentMode == DetailsViewMode.Edit) { //Find Drop down list from aspx page DropDownList ddlCountry = DetailsView2.FindControl("ddlCountry") as DropDownList; //check ddlCountry is not null || country drop down list is found if (ddlCountry != null) { //Bind countries data to ddlCountry ddlCountry.DataTextField = "Root_Cause_Category"; ddlCountry.DataValueField = "Root_Cause_Category"; ddlCountry.DataSource = DD_DS; //custom method that gets all countries ddlCountry.DataBind(); } } }so what am i missing here?\[/code\]
 
Back
Top