What I am trying to do is match the text of my grid field to my dropdownlsit field text, but it always gives me the follwoing error even though the text is in the item is in the dropdown list in the grid. I am trying to match computer make and models that come up from and existing table to a new database. for example.
Optiplex 755
Optiplex 760
Precision 2000
latitude 2400
In my dropdown inside my radgird these are all in there but when the match tries to happen it tells me they are not, it should nto be a case issue.
<telerik:GridBoundColumn DataField="strSN" HeaderText="SN" />
<telerik:GridBoundColumn DataField="strComputername" HeaderText="NETWORK NAME" />
<telerik:GridBoundColumn DataField="strBrand" HeaderText="EXIST_MODEL" />
<telerik:GridTemplateColumn HeaderText="DB_Model">
<ItemTemplate>
<asp:DropDownList ID="ddlModel" runat="server" CausesValidation="false"></asp:DropDownList>
</ItemTemplate>
</telerik:GridTemplateColumn>
Code to fill grid dropdown
Error
but if I comment out and then populate it works and the Optiplex 760 is in the dropdownlist and is also the same as the field Exist_Model.
Optiplex 755
Optiplex 760
Precision 2000
latitude 2400
In my dropdown inside my radgird these are all in there but when the match tries to happen it tells me they are not, it should nto be a case issue.
<telerik:GridBoundColumn DataField="strSN" HeaderText="SN" />
<telerik:GridBoundColumn DataField="strComputername" HeaderText="NETWORK NAME" />
<telerik:GridBoundColumn DataField="strBrand" HeaderText="EXIST_MODEL" />
<telerik:GridTemplateColumn HeaderText="DB_Model">
<ItemTemplate>
<asp:DropDownList ID="ddlModel" runat="server" CausesValidation="false"></asp:DropDownList>
</ItemTemplate>
</telerik:GridTemplateColumn>
Code to fill grid dropdown
Protected Sub myRadGrid_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles myRadGrid.ItemDataBound
If (TypeOf e.Item Is GridDataItem) Then
Dim item As GridDataItem = CType(e.Item, GridDataItem)
Dim options As DropDownList = DirectCast(item.FindControl("ddlModel"), DropDownList)
Dim field As String = e.Item.Cells(5).Text.ToString.ToLower
sql = "Select dm.intModelId, m.strmake + ' ' + dm.strModel Model from Drat_Model dm INNER JOIN Drat_Make m on m.intMakeId = dm.intMakeId Order by strModel"
buildDD(sql, options)
'options.SelectedItem.Text = DirectCast(DataBinder.Eval(e.Item.DataItem, field).ToString(), String)
End If
End Sub
Error
DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'optiplex 760'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'optiplex 760'.
Source Error:
Line 95:
Line 96: buildDD(sql, options)
Line 97: options.SelectedItem.Text = DirectCast(DataBinder.Eval(e.Item.DataItem, field).ToString(), String)
Line 98: End If
Line 99: End Sub
but if I comment out and then populate it works and the Optiplex 760 is in the dropdownlist and is also the same as the field Exist_Model.