我要插入到Datbase一些数据,我采取四场两个DropDownList和两个文本框,
当我保存在数据库中的数据后,提交"按钮,这个genrate一个错误消息。这是'proDropDownList1' has a SelectedValue which is invalid because it does not exist in the list of items. Parameter name: value
和我的DropDownList的代码 - {C}
你可以帮助我吗?
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
...........USER INFORMATION FORM...........<br />
<br />
Enter Name
<asp:TextBox ID="TextBox1" runat="server" ontextchanged="TextBox1_TextChanged"></asp:TextBox>
Father Name
<asp:TextBox ID="TextBox2" runat="server" ontextchanged="TextBox2_TextChanged"></asp:TextBox>
<br />
<br />
Country
<asp:DropDownList ID="DropDownList1" runat="server"
onselectedindexchanged="DropDownList1_SelectedIndexChanged">
<asp:ListItem>INDIA</asp:ListItem>
<asp:ListItem>PAKISTAN</asp:ListItem>
</asp:DropDownList>
City
<asp:DropDownList ID="DropDownList2" runat="server"
onselectedindexchanged="DropDownList2_SelectedIndexChanged"
style="height: 22px">
<asp:ListItem>KASHIPUR</asp:ListItem>
<asp:ListItem>LAHOR</asp:ListItem>
</asp:DropDownList>
<br />
<br />
<br />
Mob No. <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<br />
<br />
<br />
<br />
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Submit" />
<asp:Button ID="Button2" runat="server" Text="Cancel" onclick="Button2_Click" />
<br />
<br />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
的