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

Page index changes abruptly

2 Answers 51 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chanchal
Top achievements
Rank 1
Chanchal asked on 12 Mar 2009, 11:30 AM
On clicking Add New Record, grid show the last page always.

My code excerpt for the gridview is like below:

<

telerik:RadGrid ID="RadGrid2" runat="server" DataSourceID="LinqDataSource2" Skin="Office2007" 
ShowStatusBar="True" Width="100%" AutoGenerateColumns="False" AllowSorting="True"  
AllowAutomaticDeletes="true" AllowPaging="true" GridLines="None" AllowAutomaticInserts="false"
AllowAutomaticUpdates="True" OnItemInserted="RadGrid2_ItemInserted" OnItemUpdated="RadGrid2_ItemUpdated"
OnItemDeleted="RadGrid2_ItemDeleted" OnInsertCommand="RadGrid2_InsertCommand"
OnUpdateCommand="RadGrid2_UpdateCommand" OnDeleteCommand="RadGrid2_DeleteCommand"
OnItemDataBound="RadGrid2_ItemDataBound" OnItemCommand="RadGrid2_ItemCommand"
OnSortCommand="RadGrid2_SortCommand" OnCancelCommand="RadGrid2_CancelCommand"
OnEditCommand="RadGrid2_EditCommand" BorderColor="#bbd9ee" OnPageIndexChanged="RadGrid2_PageIndexChanged">
<HeaderContextMenu EnableTheming="True" Skin="Office2007">
<CollapseAnimation Duration="200" Type="OutQuint" />
</HeaderContextMenu>
<PagerStyle Mode="NextPrevNumericAndAdvanced"></PagerStyle>
<MasterTableView DataKeyNames="ExerciseID" DataSourceID="LinqDataSource2" Width="100%"
CommandItemDisplay="Top">
<CommandItemSettings AddNewRecordImageUrl="images/AddNew.gif" AddNewRecordText="Add New Exercise" />
<CommandItemStyle CssClass="green_heading_underline" />
.....
.....

Code for ItemCommand is like below:
protected void RadGrid2_ItemCommand(object source, GridCommandEventArgs e)
{
if ((e.CommandName == "ExpandCollapse") || (e.CommandName == "InitInsert"))
{
UpdatePanel2.Update();
}
}

Can anybody help?

 

 

 

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 12 Mar 2009, 01:01 PM
Hello Chanchal,

Check out the latest Telerik demo which provides an example with options to display the insert form on the first page, lastpage or current page:
Using template to customize the command-item contents

Thanks
Princy.
0
PatD
Top achievements
Rank 1
answered on 25 May 2010, 08:08 PM
Princy, your link is dead.

Use:
 

<MasterTableView InsertItemPageIndexAction="ShowItemOnFirstPage">

Tags
Grid
Asked by
Chanchal
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
PatD
Top achievements
Rank 1
Share this question
or