提取和在数据库中插入数据期间Dropdownlist中的问题 [英] Problem in Dropdownlist During Fetch and insert data in database
本文介绍了提取和在数据库中插入数据期间Dropdownlist中的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在Datbase中插入一些数据,我需要四个字段,两个下拉列表和两个文本框,
当我将数据保存到数据库中时,提交按钮后,这会生成一条错误消息.即
I Want to Insert Some data into Datbase, i take four field two dropdownlist and two textbox,
when i save data in database, after submit the button , this genrate an error message. that is
'proDropDownList1' has a SelectedValue which is invalid because it does not exist in the list of items. Parameter name: value
而我的下拉列表代码是-
and my dropdownlist code is -
<asp:DropDownList ID="DropDownList1" runat="server" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" Width="161px">
推荐答案
在访问dropdownlist.selectedvale之前将数据绑定到dropdownlist.
首先查看您的下拉列表中是否有项目.
bind data to dropdownlist before u r accessing dropdownlist.selectedvale.
first see whether u r dropdownlist has items or not.
突出显示功能
http://support.microsoft.com/kb/181440 [ http://msdn.microsoft.com/en-us/library/ms171644开始. aspx [ ^ ]或在C#中用户可搜索的TextBox,RichTextBox,ListView和TreeView [
Highlight functionality
http://support.microsoft.com/kb/181440[^] - an old link but useful if you are using the ListView in report mode.
Search functionality
Doing a search on the internet will give you tons of results for this.
However, you can start with http://msdn.microsoft.com/en-us/library/ms171644.aspx[^] or A User-Searchable TextBox, RichTextBox, ListView, and TreeView in C#[^].
http://www.w3schools.com/aspnet/aspnet_examples.asp
use this for reference
这篇关于提取和在数据库中插入数据期间Dropdownlist中的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文