This is a migrated thread and some comments may be shown as answers.

Dynamic Grid Binding

4 Answers 62 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jebamalai
Top achievements
Rank 1
Jebamalai asked on 11 Sep 2008, 05:52 AM
Dear All,

I am binding the grid dynamically on runtime but when I perform the paging or sorting the data has been gone any one help me in order to rectify the same?

4 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 11 Sep 2008, 06:01 AM
Hi Jebamalai,

Most probably your grid is not bound on on the post back event. Please use NeedDataSource!

All the best,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Jebamalai
Top achievements
Rank 1
answered on 11 Sep 2008, 07:53 AM
Dear Vlad,
Thanks for your reply.

But that event is not fired while paging or sorting.

Do I need to set any other property for this?

The designer code is:

<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True"
    AllowSorting="True" GridLines="None" Skin="Office2007" AutoGenerateColumns="false"
    Width="100%" GroupingEnabled="False" PageSize="5" ShowStatusBar="True" ShowFooter="True" OnNeedDataSource="RadGrid1_NeedDataSource">
    <PagerStyle Mode="Slider"/>
    <MasterTableView NoDetailRecordsText="No Versions Found." NoMasterRecordsText="No Documents Found." GroupLoadMode="Client" HierarchyLoadMode="Client" ShowHeadersWhenNoRecords="False"
     EnableColumnsViewState="false" AutoGenerateColumns="false">
        <Columns>
            <COLUMNS_LIST>
        </Columns>
        <RowIndicatorColumn>
            <HeaderStyle Width="20px" />
        </RowIndicatorColumn>
        <ExpandCollapseColumn>
            <HeaderStyle Width="20px" />
        </ExpandCollapseColumn>
    </MasterTableView>
    <ClientSettings AllowDragToGroup="True" AllowColumnHide="True" AllowColumnsReorder="True" ReorderColumnsOnClient="True">
        <Scrolling AllowScroll="True" UseStaticHeaders="True" />
        <Selecting AllowRowSelect="True" />
        <Resizing AllowColumnResize="True" />
    </ClientSettings>
    <FilterMenu EnableTheming="True" Skin="Office2007">
        <CollapseAnimation Duration="200" Type="OutQuint" />
    </FilterMenu>
</telerik:RadGrid>

0
Sebastian
Telerik team
answered on 11 Sep 2008, 08:34 AM
Hello Jebamalai,

Generally, the NeedDataSource event should be raised automatically on paging/sorting operation as depicted in the following online help article:

http://www.telerik.com/help/aspnet-ajax/grdadvanceddatabinding.html

I noticed that you set EnableColumnViewState = false for your master table. Can this be related to the issue you mentioned? Try to set this property to true to see whether this makes a difference.

Best regards,
Stephen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Jebamalai
Top achievements
Rank 1
answered on 11 Sep 2008, 08:40 AM
Dear Stephen,

Thank you for your reply.

Actually my requirement is to bind the grid dynamically based on the search type in the application.

The first three will be permanent and other columns will vary.

For that in an article, they have specified that the property "EnableColumnViewState" to be false.  That's why I have assigned the property like this.

Tags
Grid
Asked by
Jebamalai
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Jebamalai
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or