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. Image for the cookie policy date
close icon

Two questions about the Grid Control

Hello,

I'm using the Grid Control. The Grid is configured to in Batch mode, and it upadte the data with a WebMethod. How to show a message if the update has errors?

In the client side I have some columns in readonly mode, but I want to edit the cells of these columns when I create a new row, how to do that?.

Thanks!

8 Replies

GV Gowthami V Syncfusion Team October 27, 2015 09:51 AM UTC

Hi Jorge,
Thanks for using Syncfusion products.

Query 1: The Grid is configured to in Batch mode, and it update the data with a WebMethod. How to show a message if the update has errors?

We can show an error message using the client side event “ActionFailure” when the Grid actions are not completed.

We have an issue “ActionFailure API is missing in ASP.NET Wrapper” and created a new support incident under your account. . Please log on to our support website to check for further updates.

https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents

We have tried to achieve your requirement using below workaround solution,

  <ej:Grid ID="EmployeesGrid" runat="server" Width="1500px" AllowPaging="true" >
. . . .

<EditSettings AllowEditing="True" AllowAdding="True" AllowDeleting="True" EditMode="batch"></EditSettings>
                    <ToolbarSettings ShowToolbar="True" ToolbarItems="add,edit,delete,update,cancel"></ToolbarSettings>
. . . .

<ClientSideEvents Create="create" />
            </ej:Grid>

  <script type="text/javascript">

          function create(args) {

              this.option("actionFailure", "FailMessage");

             

          }

          function FailMessage(args) {

              // args.error.error().statusText will display the status of the action failure

              alert(args.error.error().statusText);
          }

</script>
</asp:Content>


In the above code example, we have bound the actionFailure event to the grid in Create event and displayed the error message when the Grid action (update) is not completed.

Query 2: In the client side I have some columns in readonly mode, but I want to edit the cells of these columns when I create a new row, how to do that?

We understood that you have set the “AllowEditing” as false (readonly) for the particular column.

We can achieve your requirement using below code example,


<ej:Grid ID="EmployeesGrid" runat="server" Width="1500px" AllowPaging="true" >
. . . .

  <ClientSideEvents Create="create" ToolbarClick="click"/>

</ej:Grid>

      <script type="text/javascript">

          function create(args) {

//Storing editing disabled columns details initially

              window.data = this._disabledEditableColumns;


          }

          function click(args)

          {


              if (args.itemName == "Add")

                  this._disabledEditableColumns = [];

              else

                  this._disabledEditableColumns = window.data;

          }

        
</script>


Regards,
Gowthami V.



JP Jorge Pampin October 27, 2015 03:17 PM UTC

Hello,

Can you send me a project sample of the second queston? I don't undestand well the solution.

Thanks!


GV Gowthami V Syncfusion Team October 28, 2015 11:27 AM UTC

Hi Jorge,

We have created the below sample with enable “Batch”
 edit mode with the workaround provided in the previous update.


http://www.syncfusion.com/downloads/support/forum/120897/ze/ASPSample1286863648

We have set the allowEditing as “false” for the CustomerID field (read-only). While adding a new row, the read-only columns can be edited.


Regards,
Gowthami V.


JP Jorge Pampin October 28, 2015 12:59 PM UTC

Hello,

I can't reproduce it in my project. I think it is because my grid is in an ascx control instead of a aspx page, am I right?

Thanks!


GV Gowthami V Syncfusion Team October 29, 2015 11:32 AM UTC

Hi Jorge,

We have created a sample with WebUserControl (ascx control) but we are unable to reproduce the issue. 

Please refer to the sample,


http://www.syncfusion.com/downloads/support/forum/120897/ze/SampleDemo-WebUserControl821778871.zip

Please provide below details to reproduce the issue,

1.       Code example used for editing.
2.       Reproduce the issue in the above sample and share.
3.       Details of issue that you have faced while using our solution.

The provided information will help to analyze the issue and provide a solution as early as possible.

Regards,

Gowthami V.


JP Jorge Pampin October 30, 2015 08:16 AM UTC

Hello,

Finally it works! There was an error in my code.... But, if the readonly column is a checkbox, when I edit the new row instead of a checkbox control appears the text "False"/"True".

Thansks!


JP Jorge Pampin October 30, 2015 11:49 AM UTC

Hello,

I've solved it with DisplayAsCheckbox="True" EditType="Boolean"

Thanks!


GV Gowthami V Syncfusion Team November 2, 2015 05:06 AM UTC

Hi Jorge,
 
We are happy to hear that your issue has been resolved. 
 
Get back to us if you need further assistance.
 
Thanks & Regards,
 
Gowthami V.

Loader.
Live Chat Icon For mobile
Up arrow icon