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.
Unfortunately, activation email could not send to your email. Please try again.

CRUD operation not working..

Thread ID:

Created:

Updated:

Platform:

Replies:

94027 Apr 19,2010 03:41 AM Apr 20,2010 07:34 AM ASP.NET MVC (Classic) 1
loading
Tags: Grid
Elaine Sum
Asked On April 19, 2010 03:41 AM

Hi,

I am trying to get the CRUD operations working on my code, but after following the sample code online and the documentation, I am still unable to do either and 'Edit' or 'Add'. Clicking on the 'Edit' button does not do anything and clicking on 'Add' throws back an this._edit object is null. Could someone tell me what is wrong with my code?

This is my Viewpage:

<%= Html.Grid("Home")
.Datasource(Model)
.Caption("Orders CRUD")
.Column(column =>
{
column.Add(c => c.OrderID).HeaderText("Order ID");
column.Add( c => c.ShipName ).HeaderText( "Ship Name" );
column.Add( c => c.ShipCity ).HeaderText( "Ship City" );
column.Add(c => c.ShipCountry).HeaderText("Ship Country");
})
.EnablePaging()
.EnableSorting()
.EnableGrouping()
.ToolBar( tools =>
{
tools.Add( GridToolBarItems.AddNew )
.Add( GridToolBarItems.Delete )
.Add( GridToolBarItems.Edit)
.Add( GridToolBarItems.Update )
.Add( GridToolBarItems.Cancel );
} )
.Editing(edit =>
{
edit.AllowNew( true, "Add" )
.AllowDelete( true, "Delete" )
.EditMode( GridEditMode.Normal )
.PrimaryKey( key => key.Add( p => p.OrderID ) );
})

%>

And Controller:

public ActionResult Index()
{
return View( _db.Orders.Take( 20 ) );
}

[HttpPost]
public ActionResult Index( PagingParams args )
{
IEnumerable data = _db.Orders.Take( 20 );
return data.GridActions();
}

[HttpPost]
public ActionResult Edit(Order orderToUpdate)
{
try
{
_orderCollections.UpdateOrder(1028, orderToUpdate);
}
catch (Exception ex)
{

}
var data = _orderCollections.GetAllOrders();

return data.GridActions();
}

Attached is my View and Controller code. I am using VS 2010, .NET 4.0 and SyncFusion 8.203.0.18.

Regards,
Elaine





CRUD_not_working_42d4b94a.zip

Solaiappan R [Syncfusion]
Replied On April 20, 2010 07:34 AM

Hi Elaine,

We apologize for the delay in responding to the forum.
Just to let you know that, our response time would be faster if you contact us through your Direct Trac account, as we provide accelerated support within 24 hours for Direct Trac users and we recommend you to contact us through this service.

In order to perform the CRUD operations, it is necessary to include the “MicrosoftMvcValidation.debug.js” file in the master page which is required for Mvc2.0 Client-side Validation.


<asp:ContentPlaceHolder ID="TitleContent" runat="server" />
" rel="stylesheet" type="text/css" />

-------------------
-------------------

-------------------
-------------------


This will resolve all the mentioned issues and also the issues encountered while loading the application in IE8 and Mozilla. However we couldn’t reproduce "this_edit.is null" error while clicking the “Add New Record” tool item. Please include the Validation script as mentioned at the start and let us know if you still face any issues with respect to adding a new record. The issue with respect to using the Editing button from toolbar has been confirmed as a defect and we have logged a defect report for the same. The fix for this will be available in maximum of 3 business days. However the records can be easily edited by double clicking on the record and the changes can be saved by clicking the mouse or by pressing the Enter key. We have updated the corresponding incident too with the above mentioned details. Do let us know through the incident if you have any queries, so that it would be easy for us to track the details and provide speedy responses .


Thanks and Regards,
R.Solaiappan.

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.

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.

;