- Home
- Forum
- ASP.NET Web Forms
- Return rows dragged to another grid
Return rows dragged to another grid
Hi syncfusion workers, is a pleasure write another time.
In this moment I have a question. Maybe is very easy or dumb, but here is:
I have two grids with the drag and drop function.
When I drag to another grid, I have a function that checks a condition.
The idea is when the condition is false, the rows dragged returns to the original grid.
Is there a function to do that? (like a reload only in the grid)
Thank you so much, have a nice day.
SIGN IN To post a reply.
2 Replies
CA
César Alejandro Guerrero Nava
April 2, 2019 05:10 PM UTC
Or there is a form to evit add rows if the condition is false?
VN
Vignesh Natarajan
Syncfusion Team
April 3, 2019 10:53 AM UTC
Hi César,
Thanks for using Syncfusion products.
Query: “he idea is when the condition is false, the rows dragged returns to the original grid.”
From your query, we understand that you need to prevent the dropping of record based on condition. We suggest you to achieve your requirement using BeforeRowDrop event of ejGrid. Refer the below code example
|
<div style="float:left;width:50%">
<%-- Source Grid--%>
<ej:Grid ID="OrdersGrid" runat="server" AllowPaging="True" AllowRowDragAndDrop="true" Selectiontype="Multiple">
<RowDropSettings DropMapper="GridFeatures.aspx/Reordering" DropTargetID="DestGrid"/>
<PageSettings ShowDefaults="false" PageSize="9" EnableTemplates="true" Template="#pagerTemplate" />
<EditSettings AllowEditing="true"/>
<Columns>
………………………………………
</Columns>
</ej:Grid>
</div>
<%--Destination Grid--%>
<div style="float:right;width:49%">
<ej:Grid ID="DestGrid" runat="server" AllowPaging="True" AllowRowDragAndDrop="true" Selectiontype="Multiple">
<RowDropSettings DropMapper="GridFeatures.aspx/Reordering"/>
<PageSettings ShowDefaults="false" PageSize="9" EnableTemplates="true" Template="#pagerTemplate" />
<Columns>
<ej:Column Field="OrderID" HeaderText="Order ID" IsPrimaryKey="True" TextAlign="Right" Width="50" />
<ej:Column Field="CustomerID" HeaderText="Customer ID" Width="70" />
<ej:Column Field="EmployeeID" HeaderText="Employee ID" TextAlign="Right" Width="70" />
<ej:Column Field="Freight" HeaderText="Freight" TextAlign="Right" Width="50" Format="{0:C}" />
</Columns>
<ClientSideEvents BeforeRowDrop="beforedrop" />
</ej:Grid>
</div>
function beforedrop(args) {
if (args.draggedRecords[0].OrderID > 10003)
args.cancel = true;
//prevent the default action by enabling the args.cancel
} |
Refer our API documentation for your reference
Please get back to us if you have further queries.
Regards,
Vignesh Natarajan.
SIGN IN To post a reply.
- 2 Replies
- 2 Participants
-
CA César Alejandro Guerrero Nava
- Apr 2, 2019 05:06 PM UTC
- Apr 3, 2019 10:53 AM UTC