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

Issue Related to Grid

Thread ID:

Created:

Updated:

Platform:

Replies:

101003 Sep 19,2011 03:22 PM UTC Sep 20,2011 11:31 AM UTC ASP.NET MVC (Classic) 1
loading
Tags: Tools
shivkumar
Asked On September 19, 2011 03:22 PM UTC

hello,
i want to Edit selected row content in Syncfusion grid (razor view).
hpw i can do this. can you provide a information about it or sample example


Eswari S [Syncfusion]
Replied On September 20, 2011 11:31 AM UTC

Hi Shivkumar,

We have prepared the sample for grid editing and the same can be downloaded from the following link :

Sample-439078139.zip

Steps to check with the sample :

Step #1 : Specify the GridEditing mode through the EditMode

@{ Html.Syncfusion().Grid("SampleGrid")
. . . .

.Mappers(map=>{
map.InsertAction("AddOrder")
.SaveAction("OrderSave")
.DeleteAction("DeleteOrder"); // action mappers for editing operations

})
.ToolBar(tools =>
{
tools.Add(GridToolBarItems.AddNew)
.Add(GridToolBarItems.Edit)
.Add(GridToolBarItems.Delete)
.Add(GridToolBarItems.Update)
.Add(GridToolBarItems.Cancel); // toolbar items

})
.Editing(edit =>
{
edit.AllowEdit(true) // set allow edit as true
.AllowNew(true)
.AllowDelete(true);
edit.EditMode(GridEditMode.Normal); //specify the EditMode
edit.PrimaryKey(key => key.Add(p => p.OrderID)); // OrderID is the primary key

})
.Render();
}


Step #2 : [Controller]


[AcceptVerbs(HttpVerbs.Post)]

public ActionResult OrderSave(EditableOrder ord) // action for record saving
{
OrderRepository.Update(ord);

var data = OrderRepository.GetAllRecords();

return data.GridActions();

}

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult AddOrder(EditableOrder ord) // action for adding records
{
OrderRepository.Add(ord);

var data = OrderRepository.GetAllRecords();

return data.GridActions();

}

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult DeleteOrder(int OrderID) // action for deleting records
{

OrderRepository.Delete(OrderID);

var data = OrderRepository.GetAllRecords();

return data.GridActions();

}

St Step #3: Add the MicrosoftMvcValidation.debug.js file in the Layout.cshtml page.

. . .






Step #4: Add the following script files when the UnobtrusiveJavaScriptEnabled is true in web.config file.

[Web.config]



. . .
// if it is true ,add the following script files


[_Layout.cshtml]

. . . .
. . . .






Currently ,we don’t have the UG document for Razor. Shortly ,we will the update it in online. For the meantime ,we would suggest you to refer to the following UG link:

http://help.syncfusion.com/ug_93/User%20Interface/ASP.NET%20MVC/Grid/default.htm?turl=Documents%2F5711throughgridbuilder.htm

Please try this and let us know if you need any further assistance.

Regards,
Eswari.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

;