Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 03, 2010 10:03 PM by alkurta
May 13, 2009 08:54 AM|LINK
here are some gideliness for solving this problem.
Check whether the Value field of the dropdown is same as the database.column name
Check whether that columns contain null values in that column.
May 18, 2009 02:27 PM|LINK
I too have the same problem, my code:
<asp:TemplateField HeaderText="Decide:" SortExpression="Decide">
<asp:Label ID="Label2" runat="server" Text='<%# Bind("Decide") %>'></asp:Label>
<asp:DropDownList DataTextField="Decide" DataValueField="Decide" ID="DropDownList2" Runat="server" SelectedValue='<%# Bind("Decide") %>' AppendDataBoundItems="true" >
<asp:ListItem Value="Accept">Accept Job</asp:ListItem>
<asp:ListItem Value="Reject">Reject Job</asp:ListItem>
<asp:TextBox ID="TextBoxDecide" runat="server" Text='<%# Bind("Decide") %>'></asp:TextBox>
Now if I change the EditItemTemplate to <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Decide") %>'></asp:TextBox> it works fine......WTF
I have also another Template that uses the same idea, and it works fine!
All the rows in the DBASE have records in it, so can anyone give me a heads up on why this isn't working?
May 18, 2009 06:05 PM|LINK
Have you tried adding a default value in the field in the table of your database?
May 19, 2009 09:28 AM|LINK
Yeah I put in 'Awaiting' as a default value. But still the same error?
May 19, 2009 11:21 AM|LINK
I have tried this on another DetailsView as well, and it's pulling the same error.
I can't understand it at all [scratchHead]
May 20, 2009 09:29 AM|LINK
I have also altered the Dbase column to a bit 1 or 0, and set the default value to 0. Taken the Not Null option off as well, but it is STILL returning the same error.
I have even changed it to char(9) and put the default value as Awaiting, still no luck.
Thought I would try radio buttons instead, and it still pulls the same error, what's going on?
Jun 24, 2009 06:10 PM|LINK
Just to follow up on a previous suggestion I ran into a similar problem getting this error message. I did have to go back to my SQL Server 2008 table and modify columns that corresponded to the dropdownlist items. I think perhaps the slightest difference
such as column length or format such as char or nchar could cause problems. Also using dropdownlists to insert we often require some sort of default option on a pre-select. When it comes to edits in a GridView I think we only want to pre-select existing values.
When copying code from forms and placing it in the GridView Template we must think about what is happening and make our adjdustments such as not including a detault value that has no real value in a column of our target table. It is possible that on an insert
when a listitem on a dropdownlist is left untouched hence sent as a default value that code behind overrides and selects a valid value before the SQL insert is done. Could end up being a little tricky.
Jul 01, 2009 02:43 PM|LINK
the first post was in 2004
the last one was in 2009
I'm facing the same porblem and until now there is no official solution from MS ?!
Jul 06, 2009 11:15 AM|LINK
Here's a forgiving DropDownList allowing you to bind to invalid values. Hope it can help someone. :)