user2234471
user2234471

Reputation:

bind data to telerik datagrid in asp.net

I have the code below , i bind data from database to telerik data grid "gridCommon" .

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

In my 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>

But gridArea doesn't show the data , I want to know why ?

Upvotes: 2

Views: 1169

Answers (1)

zey
zey

Reputation: 6103

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

Upvotes: 3

Related Questions