2

我有下面的代码,我将数据库中的数据绑定到 Telerik 数据网格“gridCommon”。

gridCommon.DataSource = DbContext.MTO_General_Commons.ToList();

在我的 aspx 中,

  <telerik:RadGrid ID="gridCommon" runat="server" AllowPaging="True" AllowSorting="True"
        AutoGenerateColumns="False" ShowStatusBar="True" CellSpacing="0" GridLines="None"
        Width="470px" OnNeedDataSource="gridCommon_dataRebind" OnInsertCommand="gridCommonInsert"
        OnUpdateCommand="gridCommonUpdate" OnDeleteCommand="gridCommonDelete">
        <MasterTableView DataKeyNames="CommonID" CommandItemDisplay="Top">
            <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
            <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
            </RowIndicatorColumn>
            <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Edit" UniqueName="EditCommandColmun">
                </telerik:GridButtonColumn>
                <telerik:GridBoundColumn DataField="Name" FilterControlAltText="Filter Name column"
                    HeaderText="Name" UniqueName="Name">
                </telerik:GridBoundColumn>
                <telerik:GridButtonColumn ConfirmText="Are you sure to delete ?" ConfirmDialogType="RadWindow"
                    ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete">
                </telerik:GridButtonColumn>
            </Columns>
        </MasterTableView>
        <FilterMenu EnableImageSprites="False">
        </FilterMenu>
    </telerik:RadGrid>

但是gridArea没有显示数据,我想知道为什么?

4

1 回答 1

3
gridCommon.DataSource = DbContext.MTO_General_Commons.ToList();
gridCommon.DataBind();
于 2013-04-02T04:21:29.487 回答