简体   繁体   English

GridView无效的列名称

[英]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. 我在多视图中有一个gridview0,当我单击行上的select时,我将GridView0_SelectedIndexChanged子更改为多视图中的另一个视图,该视图具有不同的gridview1,但数据源与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. 这是当它出错时,它显示无效的列名错误,该列名是所选的第一个gridview0行的数据键名。

The first image is the view of gridview0, and the second is the error that occurs when I click select. 第一个图像是gridview0的视图,第二个图像是我单击选择时发生的错误。 Thanks! 谢谢!

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

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

Protected Sub GridView0_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView0.SelectedIndexChanged 受保护的子GridView0_SelectedIndexChanged(ByVal发送者作为对象,ByVal e作为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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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