I've got a GridView thats bound to a table. It displays contents fine. But then I have created a CheckList that is supposed to filter what results show up in the GridView. However, I keep getting the message: 'System.Data.DataRowView' does not contain a property with the name 'ID'Whenever I click the CheckBox and submit the term I'm searching for. But the weird thing is - I know ID exists, b/c it shows up just fine when I don't apply the filter. Here is the vb code:
Partial Class LoggedIn_SearchGames Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load If Me.IsPostBack = False Then SqlDataSource1.SelectParameters.Add(New Parameter("varQuery", TypeCode.String)) SqlDataSource1.SelectParameters("varQuery").DefaultValue = "dodgeball" SqlDataSource1.SelectParameters.Add(New Parameter("varUserName", TypeCode.String)) SqlDataSource1.SelectParameters("varUserName").DefaultValue = Profile.UserName SqlDataSource1.SelectParameters.Add(New Parameter("varTitle", TypeCode.Int16)) SqlDataSource1.SelectParameters("varTitle").DefaultValue = 0 SqlDataSource1.SelectParameters.Add(New Parameter("varDescription", TypeCode.Int16)) SqlDataSource1.SelectParameters("varDescription").DefaultValue = 0 SqlDataSource1.SelectParameters.Add(New Parameter("varDangers", TypeCode.Int16)) SqlDataSource1.SelectParameters("varDangers").DefaultValue = 0 SqlDataSource1.SelectParameters.Add(New Parameter("varVariants", TypeCode.Int16)) SqlDataSource1.SelectParameters("varVariants").DefaultValue = 0 SqlDataSource1.SelectParameters.Add(New Parameter("varSource", TypeCode.Int16)) SqlDataSource1.SelectParameters("varSource").DefaultValue = 0 SqlDataSource1.SelectParameters.Add(New Parameter("varCount", TypeCode.String)) SqlDataSource1.SelectParameters("varCount").DefaultValue = 0 GridView1.Visible = True MultiView1.Visible = True MultiView1.ActiveViewIndex = 0 End If End Sub Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles GridView1.RowDataBound ' Sets null cells to more pretty values. If e.Row.RowType = DataControlRowType.DataRow Then If IsDBNull(e.Row.DataItem("Popularity2")) Then e.Row.Cells(3).Text = "-" End If If IsDBNull(e.Row.DataItem("Popularity")) Then e.Row.Cells(4).Text = "-" End If If IsDBNull(e.Row.DataItem("LastPlayedDate")) Then e.Row.Cells(5).Text = "Never" End If End If ' Changes numeric value to text value for presentation purposes. If e.Row.RowType = DataControlRowType.DataRow Then Select Case e.Row.Cells(6).Text Case 1 e.Row.Cells(6).Text = "Active Inside" Case 2 e.Row.Cells(6).Text = "Semi-Active Inside" Case 3 e.Row.Cells(6).Text = "Inactive Inside" Case 4 e.Row.Cells(6).Text = "Chair Game" Case 5 e.Row.Cells(6).Text = "Active Outside" Case 6 e.Row.Cells(6).Text = "Semi-Active Outside" Case 7 e.Row.Cells(6).Text = "Inactive Outside" Case 8 e.Row.Cells(6).Text = "Water Game" Case 9 e.Row.Cells(6).Text = "Messy Game" Case 10 e.Row.Cells(6).Text = "Trick " End Select End If End Sub Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click &n
------------- - http://www.davemackey.net/" rel="nofollow - Dave Mackey - Virtual Home.
|