- Home
- Forum
- ASP.NET Web Forms
- Two questions about the Grid Control
Two questions about the Grid Control
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!
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> <ClientSideEvents Create="create" /> <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> |
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; } |
Regards,
Gowthami V.
Can you send me a project sample of the second queston? I don't undestand well the solution.
Thanks!
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.
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!
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,
The provided information will help to analyze the issue and provide a solution as early as possible.
Regards,
Gowthami V.
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!
I've solved it with DisplayAsCheckbox="True" EditType="Boolean"
Thanks!
We are happy to hear that your issue has been resolved.
Get back to us if you need further assistance.
Thanks & Regards,
Gowthami V.
- 8 Replies
- 2 Participants
-
JP Jorge Pampin
- Oct 26, 2015 01:01 PM UTC
- Nov 2, 2015 05:06 AM UTC