通过 boundfield 将 DBCONTEXT 绑定到 gridview

Binding DBCONTEXT to gridview via boundfield

我有一个网格视图:

 <asp:GridView ID="ParentSelect" runat="server" AutoGenerateColumns="false" OnRowCommand="ParentSelect_RowCommand" OnRowCreated="ParentSelect_RowCreated" emptydatatext="Please Submit A Clip. C'mon dude." ShowHeaderWhenEmpty="true" HorizontalAlign="Center" Width="600" CssClass= "table table-striped table-bordered table-condensed">
<HeaderStyle BorderColor="Black"   />
<Columns>
    <asp:BoundField DataField ="dbContext.Mains.VideoUrl" HeaderText="Title" Visible="false" />
</Columns>
      </asp:GridView>

并且我已经绑定了我的 DBCONTEXT:

protected void LoadGrid()
{
    ParentSelect.DataSource = dbContext.Mains.ToList(); 
    ParentSelect.DataBind();
}

我想通过 BoundField 在我的 gridview 上显示数据库中的数据。我怎样才能做到这一点? 请谢谢。

就这么简单:

<asp:BoundField DataField ="VideoUrl" HeaderText="Title" />