Gridview Databind仅显示第一项

时间:2019-01-02 16:16:53

标签: vb.net data-binding

很抱歉,这个问题似乎很愚蠢,但是我是一个非常新的实习生,并且使用vb有点挣扎。我目前正在尝试将所有WebsiteID数据绑定到gv,并且仅得到第一个结果,由于使用.First,我感觉像是它的结果,但是我主要是修改现有代码,因此取出时会出错。任何帮助表示赞赏!

Private Sub LoadAuthorizedWebsites(p_GroupID As String)
        Dim context As WebCMEntities.WebCMModelContainer
        Dim authorizedGroups As WebCMEntities.WebCMAuthorizedGroups

        context = New WebCMEntities.WebCMModelContainer

        authorizedGroups = context.WebCMAuthorizedGroups.Where(Function(x) x.WebCMGroupsGroupID = New Guid(p_GroupID)).First

        gvAuthorizedWebsites.DataSource = context.WebCMWebsites.Where(Function(x) x.WebsiteID = authorizedGroups.WebCMWebsiteWebsiteID).ToList
        gvAuthorizedWebsites.DataBind()


    End Sub

0 个答案:

没有答案