radGrid - Batch Editing

21 posts, 0 answers
  1. miksh
    miksh avatar
    275 posts
    Member since:
    Nov 2006

    Posted 22 Apr 2014 Link to this post

    It would be great if you update the demo at http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/batch-editing/defaultcs.aspx with a possibility to remove the new rows. Currently, the only way to do it is to cancel all updates.
  2. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 23 Apr 2014 Link to this post

    Hi,

    Thank you for your suggestion.

    We agree with you that it would be better if there is a possibility to remove the new rows in a scenario with Batch editing. Therefore, we are planning to create a new code library project which demonstrates the functionality you are looking for.

    Regards,
    Pavlina
    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.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. miksh
    miksh avatar
    275 posts
    Member since:
    Nov 2006

    Posted 23 Apr 2014 in reply to Pavlina Link to this post

    Thanks a lot. We are currently implementing such a scenario and would appreciate you very much if you could make this example soon (or publish code snippet showing how to achieve it).
  5. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 28 Apr 2014 Link to this post

    Hello,

    We will do our best to post the code library as soon as possible. I will write you back once it is ready.

    Regards,
    Pavlina
    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.

     
  6. miksh
    miksh avatar
    275 posts
    Member since:
    Nov 2006

    Posted 09 May 2014 Link to this post

    Sorry, any ETA on the code library post? We need to implement it during May.
  7. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 13 May 2014 Link to this post

    Hello,

    You can find attached a sample project that demonstrates a RadGrid in Batch editing mode with added Delete button. The button is also displayed when Add new record is pressed. Please give it a try and let me know if it works for you.

    Regards,
    Pavlina
    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.

     
  8. Graham
    Graham avatar
    6 posts
    Member since:
    May 2014

    Posted 16 Oct 2014 in reply to Pavlina Link to this post

    Hi,
    Thanks for that code snippet. I have used this and I can see the button and it does delete the row. However I am finding that if you have validation on the row, that makes the new row invalid (say it has a required text field) it will also refresh the whole grid back to it's original state when you delete the new row. So if you edit rows in the grid then create a new one and delete it (whilst it has a validation error) then all the changes in the grid are lost.

    Is there a way to stop this from happening. I have tried disabling validation prior to the delete in script, but then the grid can get into a state where the "New Row" button will not work more than once (as the first new row cannot be stored and have the red triangles appear even when you click away)

    Thanks

    Graham
  9. Graham
    Graham avatar
    6 posts
    Member since:
    May 2014

    Posted 17 Oct 2014 Link to this post

    I have been able to reproduce the issue I'm having in the demo at

    http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/batch-editing/defaultcs.aspx

    To reproduce try the following
    1. Go to the demo and click the radio button for Row edit
    2. Click Add new record
    3. Enter a value in the first column and tab over to the last column and enter a number
    4. Hit tab to leave the row and the number you entered in the last column disappears.

    Another way to cause a problem is

    1. Go to the demo and click the radio button for row edit
    2. Click Add new record
    3. Enter a value in the first column and tab over to the last column and enter a number.
    4. Click the delete button on the right of the row... all good so far
    5. Click add new row
    6. Enter a value in the first column and a number in the last and whilst the cursor is still in the last field immediately click "add new record"
    7. No new row is added and the row that was just added doesn't get the red triangles to show the new values. It looks like the delete of the new row in step 4 breaks the state of the grid somehow. See attachment. This is the issue I mentioned in my previous post.

    It looks like these issues only effect the row edit mode as I cannot reproduce them in Cell mode.

    Thanks
  10. Graham
    Graham avatar
    6 posts
    Member since:
    May 2014

    Posted 17 Oct 2014 Link to this post

    Hi Again,
    I was wrong there's the same problem in cell mode as well as row mode on the Demo. i.e. if you create new row then delete it, then create another new row and hit the save button, an error is thrown and the record is not saved.

    Please let me know if there is a way to get around these issues as I'd very much like to allow users to delete newly created rows.

    Thanks

  11. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 21 Oct 2014 Link to this post

    Hello Graham,

    Thank you for the provided step by step instructions. Indeed the described problem can be reproduced even in the demo, however, it is already logged in the ideas and feedback portal and our developers will fix it as soon as possible. You can follow the status of this bug in following link:
    http://feedback.telerik.com/Project/108/Feedback/Details/133731-fix-radgrid-editmode-batch-throws-server-exception-when-new-record-is-added-an

    Regards,
    Pavlina
    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.

     
  12. Emrah
    Emrah avatar
    6 posts
    Member since:
    Nov 2012

    Posted 13 Nov 2014 in reply to Pavlina Link to this post

    Is there a way around to fix this issue until it has been resolved? I need to get this implemented ASAP as I want my users to delete rows after they have added it?

    Thanks..
  13. Cerana
    Cerana avatar
    1 posts
    Member since:
    Nov 2014

    Posted 14 Nov 2014 in reply to Pavlina Link to this post

    Hi,

    Any update on this? I really need to get a fix for this issue.
  14. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 14 Nov 2014 Link to this post

    Hello,

    This bug is already fixed and the fix will be available in Q3 2014 SP1 expected at the begging of December. The status of the public item is also updated:
    http://feedback.telerik.com/Project/108/Feedback/Details/133731-fix-radgrid-editmode-batch-throws-server-exception-when-new-record-is-added-an

    Regards,
    Pavlina
    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.

     
  15. Dhamodharan
    Dhamodharan avatar
    300 posts
    Member since:
    Sep 2010

    Posted 03 Dec 2014 in reply to Pavlina Link to this post

    Hi Pavlina/Miksh,

    Is there any updates about this issue?
  16. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 08 Dec 2014 Link to this post

    Hi,

    The Q3 2014 SP1 release is scheduled for tomorrow 12/9/2014. You can download it from your account once it is available and test the grid batch editing functionality.

    Regards,
    Pavlina
    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.

     
  17. Dhamodharan
    Dhamodharan avatar
    300 posts
    Member since:
    Sep 2010

    Posted 11 Dec 2014 in reply to Pavlina Link to this post

    Hi Pavlina,

    I am not able to see livedemo in C:\Program Files\Telerik\UI for ASP.NET AJAX Q3 2014. can you please help me about this one


    Thanks,
    Dhamu
  18. Dhamodharan
    Dhamodharan avatar
    300 posts
    Member since:
    Sep 2010

    Posted 11 Dec 2014 in reply to Pavlina Link to this post

    Hi Pavlina,

    I am not able to see livedemo in C:\Program Files\Telerik\UI for ASP.NET AJAX Q3 2014. please help me how to get livedemo

    Thanks,
    Dhamu
  19. Dhamodharan
    Dhamodharan avatar
    300 posts
    Member since:
    Sep 2010

    Posted 11 Dec 2014 in reply to Pavlina Link to this post

    Hi Pavlina,

    I am not able see livedemo in UI for ASP.NET AJAX Q3 2014. Please help me how to get this livedemo

    Thanks,
    Dhamu
  20. Dhamodharan
    Dhamodharan avatar
    300 posts
    Member since:
    Sep 2010

    Posted 11 Dec 2014 in reply to Dhamodharan Link to this post

    Hi Palvina/miksh/Graham/Emrah/Cerana,

    I am using RadClientDataSource for radgrid. but WCF page is not calling. because the grid is displayed null value.Please check my code and let me know what is the issue,

    ASPX

    <script type="text/javascript">
    //<![CDATA[
    function ParameterMap(sender, args) {
    if (args.get_type() != "read" && args.get_data()) {
    args.set_parameterFormat({ customersJSON: kendo.stringify(args.get_data().models) });
    }
    }

    function Parse(sender, args) {
    var response = args.get_response().d;
    if (response) {
    args.set_parsedData(response.Data);
    }
    }

    function UserAction(sender, args) {
    if (sender.get_batchEditingManager().hasChanges(sender.get_masterTableView()) &&
    !confirm("Any changes will be cleared. Are you sure you want to perform this action?")) {
    args.set_cancel(true);
    }
    }
    //]]>
    </script>
    </telerik:RadScriptBlock>
    <telerik:RadSkinManager ID="QsfSkinManager" runat="server" ShowChooser="true" />
    <telerik:RadFormDecorator ID="QsfFromDecorator" runat="server" DecoratedControls="All" EnableRoundedCorners="false" />
    <div>
    <br />
    <br />
    <h3>RadGrid bound to RadClientDataSource</h3>
    <telerik:RadGrid ID="RadGrid1" runat="server"
    ClientDataSourceID="RadClientDataSource1" AllowPaging="True"
    AllowSorting="True" AllowFilteringByColumn="True" CellSpacing="-1"
    GridLines="Both" GroupPanelPosition="Top" ResolvedRenderMode="Classic">
    <MasterTableView ClientDataKeyNames="ATT_TYP_ID" EditMode="Batch" CommandItemDisplay="Top">
    <Columns>
    <telerik:GridBoundColumn DataField="ATT_TYP_CODE" HeaderText="Type Code" ColumnEditorID="GridTextBoxEditor">
    </telerik:GridBoundColumn>
    <telerik:GridBoundColumn DataField="DESCRIPTION" HeaderText="Description" ColumnEditorID="GridTextBoxEditor">
    </telerik:GridBoundColumn>
    <telerik:GridBoundColumn DataField="SECURE_FLAG" HeaderText="Secure?" ColumnEditorID="GridCheckBoxEditor">
    </telerik:GridBoundColumn>
    <telerik:GridClientDeleteColumn HeaderText="Delete" ButtonType="ImageButton">
    <HeaderStyle Width="70px" />
    </telerik:GridClientDeleteColumn>
    </Columns>
    </MasterTableView>
    <ClientSettings>
    <ClientEvents OnUserAction="UserAction" />
    </ClientSettings>
    </telerik:RadGrid>
    <telerik:GridTextBoxColumnEditor ID="GridTextBoxEditor" runat="server" TextBoxStyle-Width="200px"></telerik:GridTextBoxColumnEditor>
    <telerik:GridCheckBoxColumnEditor ID="GridCheckBoxEditor" runat="server"></telerik:GridCheckBoxColumnEditor>
    <telerik:RadClientDataSource ID="RadClientDataSource1" runat="server" AllowBatchOperations="true">
    <ClientEvents OnCustomParameter="ParameterMap" OnDataParse="Parse" />
    <DataSource>
    <WebServiceDataSourceSettings BaseUrl="EditingWcfService.svc">
    <Select Url="GetCustomers" DataType="JSON" />
    <%-- <Update Url="UpdateCustomers" DataType="JSON" />
    <Insert Url="InsertCustomers" DataType="JSON" />
    <Delete Url="DeleteCustomers" DataType="JSON" />--%>
    </WebServiceDataSourceSettings>
    </DataSource>
    <Schema>
    <Model ID="ATT_TYP_ID">
    <telerik:ClientDataSourceModelField FieldName="ATT_TYP_ID" DataType="Number" />
    <telerik:ClientDataSourceModelField FieldName="ATT_TYP_CODE" DataType="String" />
    <telerik:ClientDataSourceModelField FieldName="DESCRIPTION" DataType="String" />
    <telerik:ClientDataSourceModelField FieldName="SECURE_FLAG" DataType="String" />
    </Model>
    </Schema>
    </telerik:RadClientDataSource>
    </div>

    EditingWcfService.cs

    [ServiceKnownType(typeof(ServiceCustomer))]
    [ServiceContract]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class EditingWcfService
    {
    [WebGet]
    [AspNetCacheProfile("NoCache")]
    public CustomersResult GetCustomers()
    {
    NorthwindReadWriteEntities entities = new NorthwindReadWriteEntities();
    return new CustomersResult
    {
    Data = entities.ATTACHMENT_TYPES.ToList().Select(c => new ServiceCustomer
    {
    att_typ_id = c.ATT_TYP_ID,
    att_typ_code = HttpUtility.HtmlEncode(c.ATT_TYP_CODE),
    description = HttpUtility.HtmlEncode(c.DESCRIPTION),
    secure_flag = HttpUtility.HtmlEncode(c.SECURE_FLAG),
    }).ToList(),
    Count = 100
    };
    }

    [WebGet]
    [AspNetCacheProfile("NoCache")]
    public void UpdateCustomers(string customersJSON)
    {
    JavaScriptSerializer serializer = new JavaScriptSerializer();
    List<ServiceCustomer> customers = (List<ServiceCustomer>)serializer.Deserialize(customersJSON, typeof(List<ServiceCustomer>));
    NorthwindReadWriteEntities entities = new NorthwindReadWriteEntities();
    foreach (ServiceCustomer serviceCustomer in customers)
    {
    ATTACHMENT_TYPES customer = entities.ATTACHMENT_TYPES.FirstOrDefault(c => c.ATT_TYP_ID == serviceCustomer.att_typ_id);
    customer.ATT_TYP_CODE = serviceCustomer.att_typ_code;
    customer.DESCRIPTION = serviceCustomer.description;
    customer.SECURE_FLAG = serviceCustomer.secure_flag;
    }
    entities.SaveChanges();
    }

    [WebGet]
    [AspNetCacheProfile("NoCache")]
    public CustomersResult InsertCustomers(string customersJSON)
    {
    JavaScriptSerializer serializer = new JavaScriptSerializer();
    List<ServiceCustomer> customers = (List<ServiceCustomer>)serializer.Deserialize(customersJSON, typeof(List<ServiceCustomer>));
    NorthwindReadWriteEntities entities = new NorthwindReadWriteEntities();
    foreach (ServiceCustomer serviceCustomer in customers)
    {
    ATTACHMENT_TYPES newCustomer = new ATTACHMENT_TYPES()
    {
    ATT_TYP_ID = 0,
    ATT_TYP_CODE = serviceCustomer.att_typ_code,
    DESCRIPTION = serviceCustomer.description,
    SECURE_FLAG = serviceCustomer.secure_flag,
    };
    serviceCustomer.att_typ_id = newCustomer.ATT_TYP_ID;
    entities.AddToATTACHMENT_TYPES(newCustomer);
    }
    entities.SaveChanges();
    return new CustomersResult
    {
    Data = customers
    };
    }

    [WebGet]
    [AspNetCacheProfile("NoCache")]
    public object DeleteCustomers(string customersJSON)
    {
    JavaScriptSerializer serializer = new JavaScriptSerializer();
    List<ServiceCustomer> customers = (List<ServiceCustomer>)serializer.Deserialize(customersJSON, typeof(List<ServiceCustomer>));
    NorthwindReadWriteEntities entities = new NorthwindReadWriteEntities();
    foreach (ServiceCustomer serviceCustomer in customers)
    {
    ATTACHMENT_TYPES customer = entities.ATTACHMENT_TYPES.FirstOrDefault(c => c.ATT_TYP_ID == serviceCustomer.att_typ_id);
    entities.DeleteObject(customer);
    }
    entities.SaveChanges();
    return customersJSON;
    }

    // Add more operations here and mark them with [OperationContract]
    }
    [DataContract]
    public class ServiceCustomer
    {
    [DataMember]
    public int att_typ_id { get; set; }
    [DataMember]
    public string att_typ_code { get; set; }
    [DataMember]
    public string description { get; set; }
    [DataMember]
    public string secure_flag { get; set; }

    }

    public class CustomersResult
    {
    public List<ServiceCustomer> Data { get; set; }
    public int Count { get; set; }
    }

    public class CustomersEditResult
    {
    public List<ServiceCustomer> models { get; set; }
    }

    Thanks in Advance,
    Dhamu




  21. Dhamodharan
    Dhamodharan avatar
    300 posts
    Member since:
    Sep 2010

    Posted 11 Dec 2014 in reply to Dhamodharan Link to this post

    Hi All,

    I ran the code in Immediate window for javascript function

    function ParameterMap(sender, args) {
              if (args.get_type() != "read" && args.get_data()) {
                    args.set_parameterFormat({ customersJSON: kendo.stringify(args.get_data().models) });
                }
            }

    but i got following values in page load

    args.get_type() is read
    kendo.stringify(args.get_data().models) is undefined

    Please help me do we need to set any setting. Please help me ASAP.

    Thanks,
    Dhamu
  22. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 16 Dec 2014 Link to this post

    Hi Dhamu,

    Attached you can find the demo for batch editing with ClientDataSource isolated in a sample project. Give it a try and change your application according to it in order to make it working.

    I hope this helps.

    Regards,
    Pavlina
    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.

     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017