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

How to get the modified values or modified rows with values before the user moves another pager using the pager of the RaGrid in the codebehind ?

1 Answer 55 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Surendiran
Top achievements
Rank 1
Surendiran asked on 16 Oct 2014, 12:52 PM
Hi Team,

User Action : User will do a single click and modify the cells and he will go the next page of the RadGrid by click on the pager. User will modify the values in the next page and so on and when user comes back to the previous page the user should see the modified values. There should not be any popup or any warning when the user moves from one page to another page using pager.



How to get the modified values or modified rows with values before the user moves another pager using the pager of the RaGrid in the codebehind ? Is there any event where we can get the modified rows?

.ASPX Content:
<form id="form1" runat="server">
        <telerik:RadScriptManager ID="ScriptManager1" runat="server" EnableTheming="True">
            <Scripts>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js">
                </asp:ScriptReference>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js">
                </asp:ScriptReference>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js">
                </asp:ScriptReference>
            </Scripts>
        </telerik:RadScriptManager>
    <div>
    
                <br />
        <div>
            Click the button to load the Student data</div>
           <br />
        <telerik:RadButton ID="btnLoadStudent" runat="server" Text="Load Student" OnClick="btnLoadStudent_Click">
        </telerik:RadButton>
         
              <br />
        
        <br />
        <div style="color: #800080">
            The below grid uses BatchEdit Mode:  (BatchEditingSettings EditType="Cell" )</div>
          <br />
        <telerik:RadGrid ID="rgStudent" runat="server" AllowPaging="True" AllowSorting="True" PageSize="4" AutoGenerateColumns="False" GridLines="Both" OnPageIndexChanged="rgStudent_PageIndexChanged" Width="673px">
            <MasterTableView EditMode="Batch"  DataKeyNames="StudentID" >
                      <BatchEditingSettings EditType="Cell" />
                <RowIndicatorColumn Visible="False">
                </RowIndicatorColumn>
                <ExpandCollapseColumn Created="True">
                </ExpandCollapseColumn>
                <Columns>
                    <telerik:GridTemplateColumn DataField="StudentID" DataType="System.Byte" FilterControlAltText="Filter StudentID column" HeaderText="StudentID" SortExpression="StudentID" UniqueName="StudentID">
                       <%-- <EditItemTemplate>
                            <asp:TextBox ID="StudentIDTextBox" runat="server" Text='<%# Bind("StudentID") %>'></asp:TextBox>
                        </EditItemTemplate>--%>
                        <ItemTemplate>
                            <asp:Label ID="StudentIDLabel" runat="server" Text='<%# Eval("StudentID") %>'></asp:Label>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn DataField="StudentName" FilterControlAltText="Filter StudentName column" HeaderText="StudentName" SortExpression="StudentName" UniqueName="StudentName">
                        <EditItemTemplate>
                            <asp:TextBox ID="StudentNameTextBox" runat="server" Text='<%# Bind("StudentName") %>' Width="75px"></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="StudentNameLabel" runat="server" Text='<%# Eval("StudentName") %>'></asp:Label>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn DataField="Mark" DataType="System.Byte" FilterControlAltText="Filter Mark column" HeaderText="Mark" SortExpression="Mark" UniqueName="Mark">
                        <EditItemTemplate>
                            <asp:TextBox ID="MarkTextBox"  Width="75px" runat="server" Text='<%# Bind("Mark") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="MarkLabel" runat="server" Text='<%# Eval("Mark") %>'></asp:Label>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn DataField="Grade" FilterControlAltText="Filter Grade column" HeaderText="Grade" SortExpression="Grade" UniqueName="Grade">
                        <EditItemTemplate>
                            <asp:TextBox ID="GradeTextBox" Width="75px" runat="server" Text='<%# Bind("Grade") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="GradeLabel" runat="server" Text='<%# Eval("Grade") %>'></asp:Label>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn DataField="Phone" FilterControlAltText="Filter Phone column" HeaderText="Phone" SortExpression="Phone" UniqueName="Phone">
                        <EditItemTemplate>
                            <asp:TextBox ID="PhoneTextBox" Width="75px"  runat="server" Text='<%# Bind("Phone") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="PhoneLabel" runat="server" Text='<%# Eval("Phone") %>'></asp:Label>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
    </div>             <br/>

                        <div>
                            User Action : User will do a single click and modify the cells and he will go the next page of the RadGrid by click on the pager. User will modify the values in the next page and so on and when user comes back to the previous page the user should see the modified values. There should not be any popup or any warning when the user moves from one page to another page using pager.</div>
           <br/>
                   <div>
                       How to get the modified values or modified rows with values before the user moves another pager 
                       using the pager of the RaGrid in the codebehind ? Is there any event where we can get the modified rows?</div>
   
    </form>

.cs Content
public partial class RadGrdiForm : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnLoadStudent_Click(object sender, EventArgs e)
        {
            this.rgStudent.DataSource = this.GetStudentData();
            this.rgStudent.DataBind();
        }

        public RadGridProofOfConcept.StudentDS.tblStudentDataTable GetStudentData()
        {
            RadGridProofOfConcept.StudentDSTableAdapters.tblStudentTableAdapter adapter = new StudentDSTableAdapters.tblStudentTableAdapter();
            return adapter.GetData();
        }

        protected void rgStudent_PageIndexChanged(object sender, Telerik.Web.UI.GridPageChangedEventArgs e)
        {
            this.rgStudent.CurrentPageIndex = e.NewPageIndex;
            this.rgStudent.DataSource = this.GetStudentData();
            this.rgStudent.DataBind();
        }
    }

Is there anyway to attach the sample code which we are working

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 21 Oct 2014, 08:19 AM
Hi Surendiran,

With the built-in functionality of RadGrid and Batch Editing in particular, it will not be possible to retrieve and preserve the changes after each operation that will cause a rebind of the grid, mainly because this will rebuild the grid structure and refresh its data. Furthermore, the changes are passed to the server only if the Save Changes button is clicked or after the saveChanges method is called (or one of the other BatchEditingManager methods that will initiate saving).

Once again, with those limitations it would not be possible to preserve the changes after a complex operation (like paging, filtering, sorting, etc.) is performed.


Regards,
Konstantin Dikov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Surendiran
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or