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

why rad grid is binding data two times?

1 Answer 112 Views
Grid
This is a migrated thread and some comments may be shown as answers.
khaled jendi
Top achievements
Rank 1
khaled jendi asked on 23 Aug 2011, 05:46 AM
hi,
I have this rad grid:
                                                                <telerik:RadGrid ID="RadGrid1"
                        AllowSorting="True"
                        AllowPaging="True" PageSize="5" runat="server" GridLines="None" Width="95%"
                        OnItemCommand="RadGrid1_ItemCommand"
                        OnNeedDataSource="RadGrid1_NeedDataSource" Skin="Sunset">
                        <ExportSettings HideStructureColumns="true" />
                             <MasterTableView Width="100%" CommandItemDisplay="Top"   >


                             <Columns>
                                <telerik:GridBoundColumn DataField="SerialNum" />
                                <telerik:GridBoundColumn DataField="Name" HeaderText="Name"  />
                                <telerik:GridBoundColumn DataField="UserName" HeaderText="User Name" />
                                <telerik:GridBoundColumn DataField="Phone1" HeaderText="Phone-1-"  />
                                <telerik:GridBoundColumn DataField="Email" HeaderText="Email" />
                                <telerik:GridBoundColumn DataField="Phone2" HeaderText="Phone-2-" />
                                <telerik:GridBoundColumn DataField="ActiveState" HeaderText="Active State" />
                                <telerik:GridBoundColumn DataField="Fax" HeaderText="Fax" />
                                <telerik:GridTemplateColumn>
                                    <ItemTemplate>
                                            <asp:LinkButton ID="lnkbdeactive" runat="server" CommandArgument='<%# eval("User_ID") %>'
                                                CommandName="Deactive" CssClass='<%# ShowIfNotActive(Eval("Active"), "lnkbdeactive") %>'>De-activate</asp:LinkButton>
                                            <asp:LinkButton ID="lnkbactive" runat="server" CommandArgument='<%# eval("User_ID") %>'
                                                CommandName="Active" CssClass='<%# ShowIfNotActive(Eval("Active"), "lnkbactive") %>'>Activate</asp:LinkButton>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                             </Columns>


                                <PagerStyle Mode="NextPrevNumericAndAdvanced" />
                                <CommandItemSettings ShowExportToWordButton="true" ShowExportToExcelButton="true" ShowExportToPdfButton="true" ShowAddNewRecordButton="false"
                                    ShowExportToCsvButton="true" ExportToCsvText='<%= "CSV_" & ExportSubFileName %>'    />
                            </MasterTableView>
                        </telerik:RadGrid>


now the problem when I am filling data using OnNeedDataSource
I got the grid rendered two times, I can see the grid like this:


1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 23 Aug 2011, 06:16 AM
Hello Khaled,

Check the following forum thread which discussed similar scenario.
RadGrid's NeedDataSource Firing Another Postback?

Also check the following help documentation which explains more about event sequence and Commands that invoke Rebind() implicitly.
Event sequence.

Thanks,
Princy.
Tags
Grid
Asked by
khaled jendi
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or