We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

In Grid Edit mode

Thread ID:

Created:

Updated:

Platform:

Replies:

113806 Oct 10,2013 08:59 AM UTC Oct 16,2013 11:59 AM UTC ASP.NET Web Forms (Classic) 3
loading
Tags: GridGroupingControl
Tuong Trinh
Asked On October 10, 2013 08:59 AM UTC

Hi,

the edit mode of the current record will automatically lost when another record is selected. How can we avoid this? Is is possible to leave the edit mode by save or cancel button?

regards
Tuong Trinh



Bala Murugan A.S [Syncfusion]
Replied On October 15, 2013 12:51 PM UTC

Hi Tuong Trinh,

 

Thanks for using Syncfusion Products.

 

We glad to let you know that we have created a workaround for your requirement. Please refer the below code snippets.

 

[Default.aspx]

 

<script type="text/javascript">

                    $(document).ready(function () {

                        window.Temp_OnGRMouseUp = window.EG_OnGRMouseUp; //store this event in temp

                        window.EG_OnGRMouseUp = Custom_OnGRMouseUp; //define custom client side method to prevent selection and saving records on other row selection

 

                    });

                    function Custom_OnGRMouseUp(evt) {

                        var src = GetEventSrcElement(evt);

                        if (src.tagName == "TD") {

                            var td = GetGTCell(src);

                            if (td == null) {

                                return;

                            }

                            var tr = td.parentNode;

                            var gridObj = GetEGridObj(tr);

                            var isCurRow = gridObj.IsCurrentRow(tr);

                            if (gridObj.GetState() == "Edit") {

                                if (!isCurRow) {

                                    gridObj.AllowClientSideSelection = false; //prevent client side selection

                                    evt.cancelBubble = true;

                                    return;

                                }

                            }

                            else {

                                gridObj.AllowClientSideSelection = true;

                                window.Temp_OnGRMouseUp(evt);

                            }

                        }

                    }

 

                </script>

The above solution can be achieved by overriding the EG_OnGRMouseUp client side method and preventing the client side record selections with postback.

 

For your convenience, we have prepared a simple sample to demonstrate this and the same can be downloaded from the below link.

 

Sample: PreventSelection.zip

 

Please let us know if you have any concerns.

 

Regards,

Balamurugan A.S


Tuong Trinh
Replied On October 15, 2013 03:33 PM UTC

Hi Balamurugan A.S,

this workaround is fantastic. 

Thank you for helping out.

regards
Tuong Trinh

Bala Murugan A.S [Syncfusion]
Replied On October 16, 2013 11:59 AM UTC

Hi Tuong Trinh,

Thanks for your update.

Please get back to us if you need any further assistance.

Regards,
Balamurugan A.S

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;