详细信息视图下拉列表问题::更新时不会更新到DB [英] Detail View Dropdownlist Issue:: When updating it is not updating to DB
本文介绍了详细信息视图下拉列表问题::更新时不会更新到DB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下是代码段。我有一个详细信息视图,在选择两个下拉列表时填充,我已将所需的字段转换为模板,然后从文本框更改为带有数据限制的下拉列表。现在,当我编辑详细信息视图并从下拉列表中选择项目并单击提交时,它不会更新到数据库,而是将空白值存储在数据库中。请帮助。
Below is the Code Snippet. I have a Detail View which is populated on selecting two Dropdownlist, I have converted the required Field to Template and then Changed from Text Box to Drop down list with Data bounded. Now when I edit the Detail View and Select a item from Dropdownlist and click on Submit it is not updated to DB, instead a blank value is stored in DB. Please Help.
<EditItemTemplate>
<asp:DropDownList ID="DropDownList2" runat="server" AppendDataBoundItems="true"
DataSourceID="AccessDataSource5" DataTextField='<%# Bind("Project_or_Track") %>'
DataValueField="DropDown" >
</asp:DropDownList>
</EditItemTemplate>
推荐答案
你必须定义一个更新数据源的查询,这将更新数据库。
You have to define an update query on your Datasource which will update the database.
这篇关于详细信息视图下拉列表问题::更新时不会更新到DB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文