Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
395
How to show RowEditingTemplate when <AutoPostBackFlags RowSelectionChanged="true"/>
posted

Hi guys,

my WebDataGrid has RowEditingTemplate and . When select a row to edit i'd like to show the RowEditingTemplate and also fire the server event OnRowSelectionChanged, therefore, I set the RowSelectionChanged="true". But after posting back to server the RowEditingTemplate is hidden, how to keep the RowEditingTemplate open in this case?

I have another question regarding RowAdding, is there any way to implement a template for RowAdding likes RowEditingTemplate?

Thanks,

Nam Dang

  • 29417
    Offline posted

    Hello Nam ,

     

    I’m just following up to see if you’ve been able to resolve your issue. If you have any questions or concerns or if you need further assistance please let me know.

     

    Best Regards,

    Maya Kirova

    Developer Support Engineer

    Infragistics, Inc.

    http://ko.infragistics.com/support

     

  • 29417
    Offline posted

    Hello Nam ,

     

    Thank you for posting in our forum.

     

    Generally when you trigger a postback of any kind the row edit template will be closed. If you need it to open again after the ajax request to the server is complete you would need to open it again manually. To do this you would need to persist the index of the row you need to open in edit mode. You could use a hidden field and save the currently selected row index in it during the client side RowSelectionChanged event and on AJAXResponse event get that value and set the corresponding row in edit mode. For example:

     

    function WebDataGrid1_Selection_RowSelectionChanged(sender, eventArgs)

    {    var hiddenField = document.getElementById("rowInEditModeHiddenField");

        var rowInEditMode = sender.get_behaviors().get_editingCore().get_behaviors();

        hiddenField.value = eventArgs.getSelectedRows().getItem(0).get_index();

     

    function WebDataGrid1_Grid_AJAXResponse(sender, eventArgs)

    {

        var hiddenField = document.getElementById("rowInEditModeHiddenField");

        var rowInd = hiddenField.value;

     

        if (rowInd != "") {

            var currentRow = sender.get_rows().get_row(rowInd);

            sender.get_behaviors().get_editingCore().get_behaviors().get_rowEditingTemplate().enterEditMode(currentRow);

        }

    }

     

    Then before the ajax request is send the last selected row will be saved in the hidden field and when the response returns you can use it to open the save row again.

     

    To have an editing template for the adding row you can also manually open the row editing template in the same manner using  the enterEditMode method on the adding row.

    You could for example hook that event on click of the “+” sign on the adding row to have the editor template open on click for the adding row.

     

     

    Please refer to the attached sample and let me know if you’re trying to achieve something similar. Don't hesitate to let me know if you have any questions.

     

     

    Best Regards,

    Maya Kirova

    Developer Support Engineer II

    Infragistics, Inc.

    http://ko.infragistics.com/support

     

    WDG_rowAdding_rowEditTemplate.zip