简体   繁体   中英

Gridview invalid column name

I have a gridview0 in a multiview and when I click select on a row I have the GridView0_SelectedIndexChanged sub change to a different view in the multiview, which has a different gridview1 but the same datasource as gridview0. This is when it errors out and it displays the invalid column name error, with the column name being the datakeyname of the first gridview0 row that was selected.

The first image is the view of gridview0, and the second is the error that occurs when I click select. Thanks!

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

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

Protected Sub GridView0_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles 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

添加一个新的数据源并将其设置为原始gridview的位置。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM