下拉列表的数据绑定抛出错误HTMLTextArea属性不存在

时间:2014-09-15 14:50:35

标签: asp.net

我正在使用文本框控件将记录添加到表中。数据绑定到下拉列表。我可以添加一个记录并在第一次完全重新下注下拉列表。但是,如果我尝试添加第二条记录,则dropdown databind()调用会抛出错误...

 DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'System.Web.UI.HtmlControls.HtmlTextArea'. 

数据绑定的代码是......

 Dim connectionString As String = WebConfigurationManager.ConnectionStrings("DeliverablesConnectionString").ConnectionString
        Dim cnn As New SqlConnection(connectionString)
        Dim commandSql As SqlCommand
        cnn.Open()
        commandSql = New SqlCommand("INSERT INTO tblDeliverableCategories (FunID, DeliverableCategory, State) VALUES (" & ddlFunctionalArea.Text & ", '" & txtNewDeliverableCategory.Value & "', '" & ddlStateForAdd.Text & "')", cnn)
        commandSql.ExecuteNonQuery()
        cnn.Close()
        ddlDeliverableCategory.DataSourceID = "SqlDataSourceddlDeliverableCategory"
        ddlDeliverableCategory.DataBind()
        ddlDeliverableCategory.DataValueField = txtNewDeliverableCategory.ToString()
        Dim count As Integer = ddlDeliverableCategory.Items.Count
        ddlDeliverableCategory.SelectedIndex = count - 1
        lblDelCatCreated.Text = "Deliverable Name was added."

0 个答案:

没有答案