Gridview无效的列名

时间:2010-06-29 18:26:57

标签: sql vb.net gridview

我在多视图中有一个gridview0,当我单击一行上的select时,我将GridView0_SelectedIndexChanged子更改为多视图中的另一个视图,该视图具有不同的gridview1但与gridview0具有相同的数据源。这是当它出错并显示无效的列名错误时,列名是所选第一个gridview0行的datakeyname。

第一个图像是gridview0的视图,第二个是我单击选择时发生的错误。谢谢!

image one http://img291.imageshack.us/img291/9221/gridview0.jpg

image two http://img188.imageshack.us/img188/6586/gridview1.jpg

受保护的子GridView0_SelectedIndexChanged(ByVal sender As Object,ByVal e As System.EventArgs)处理GridView0.SelectedIndexChanged

    Dim ISTag As String = GridView0.SelectedDataKey.Value.ToString
    Dim type As String = getTypeMethod(ISTag)
    filterText.Text = type
    If (type.Equals("Computer")) Then
        InventoryComputer.SelectCommand = "SELECT * FROM T_Computer WHERE ISTag = " & ISTag
        MultiView1.ActiveViewIndex = 8
    End If
End Sub

1 个答案:

答案 0 :(得分:0)

添加新数据源并设置原始gridview的位置。