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.
Syncfusion Feedback

Problem with refresh partial views

Thread ID:

Created:

Updated:

Platform:

Replies:

116476 Jun 1,2014 05:59 AM Jun 9,2014 08:01 AM ASP.NET MVC 14
loading
Tags: Grid
Jesus Sanchez
Asked On June 1, 2014 05:59 AM

Hi,
I have prepared a simple example in which I have a main view and want to upgrade another partial view within this main. In the partial view have a syncfusion Grid. When I do ' @{Html.RenderPartial ("_GridBooks");}' from a button doesn't work, even crashVS 2013.
Can you help me to solve this problem?
Thanks

Attachment: SampleApp_b80a0eb7.zip

Ragavee U S [Syncfusion]
Replied On June 2, 2014 12:38 PM

Hi Jesus

 

Thanks for using Syncfusion Products.

 

We have analyzed the sample that you have provided. We are unable to reproduce the crash issue that you have mentioned. But we found two other issues with the sample. “Misalignment in grid content when enabling .AllowSummary() and .GroupedColumnShow(false) properties in the grid” and “Issue in toolbar when grid is rendered in partialview”.

 

The screenshots corresponding to the above issues can be downloaded from the attachment.

 

We have logged defect report on the above issues. The fix for the issues will be available in our Volume 2, 2014 release at the mid of June month.

 

Please let us know if you need any further assistance.

 

Regards

Ragavee U S



Attachment: Screenshots_9e1c73f4.zip

Jesus Sanchez
Replied On June 2, 2014 01:21 PM

Thank you
waiting for resolution.

Jesus Sanchez
Replied On June 2, 2014 01:59 PM

There is another way to update partialviews that contain grid-syncfusion when you press a button through/call the controller?.
Could you send me an example?.

Thanks

Ragavee U S [Syncfusion]
Replied On June 3, 2014 06:24 AM

Hi Jesus

 

Based on your requirement, we have created a sample and the same can be downloaded from the following location:

 

Sample Link: : http://www.syncfusion.com/downloads/support/directtrac/124484/Sample124484651546245.zip

 

In the sample above, we have updated the div using AJAX call to the controller. Please refer the below code snippet:

 

[In index.cshtml]

 

<script type="text/javascript"> 

    $(document).ready(function () {

        $("#linkBtn").click(function () {

            $.ajax

                    ({

                        url: "Home/Productpartial",

                        type: 'GET',

                        success: function (data) {                           

                            $("#divProduct").html(data);

                        },

                        error: function (error) {

                            alert(eval(error))

                        }

                    });

        });

    });

</script>

 

[In Controller]

 

public ActionResult Productpartial()

        {

            var DataSource = new NorthwindDataContext().OrdersViews.ToList();

            ViewData["datasource"] = DataSource;

            return PartialView("_productpartial", ViewData);

        }

 

Please let us know if you need any further assistance.

 

Regards

Ragavee U S


Jesus Sanchez
Replied On June 3, 2014 12:34 PM

Hello
I've been testing your example and it does not work fully. I have made a few minor modifications.
Why only works the first time you press my button?
Can you help me??.
Thank you

Attachment: Sample124484_f7319224.zip

Ragavee U S [Syncfusion]
Replied On June 4, 2014 08:32 AM

Hi Jesus

 

We have analyzed the sample that you have provided.

 

Everytime the refresh button is clicked the Home/Productpartial url is invoked. Since the same dataSource is bound to the grid in the success event of the AJAX call as in the code snippet below, you are unable to view the refreshing event of the grid.

 

public ActionResult Index()

        {

            var DataSource = new NorthwindDataContext().OrdersViews.ToList();

            ViewData["datasource"] = DataSource;

            return View();

        }

        public ActionResult Productpartial()

        {

                   

            var  DataSource = new NorthwindDataContext().OrdersViews.ToList();                    

            ViewData["datasource"] = DataSource;

            return PartialView("_productpartial", ViewData);

        }

 

We have attached the screenshot for the request passed second time, the refresh button is clicked. Please find the screenshot in the attachment.

 

Please let us know if you need any further assistance.

 

Regards

Ragavee U S



Attachment: ajax_request_9d15e0bd.zip

Jesus Sanchez
Replied On June 4, 2014 11:19 AM

Hi,

I have a break point in the function:

public ActionResult Productpartial()

{

....

}

and for the first time only????????. I don´t Know???

I've fixed it in the following way:

In the jquery:

$("#btnRefresh").on("click", function (e) { .... }

instead of

$("#btnRefresh").click(function () { ... }


Anyway thanks




Jesus Sanchez
Replied On June 4, 2014 11:25 AM

Another question,
Know the selected row in my Grid (ASP.net MVC Classic) from jquery?.
Before in the version 11.3.0.30 "NO CLASSIC" it towards:

var gridObj = $find('VGastosGrid');

var selectRow = gridObj.selectedRows();

if (selectRow != "") {

var id = selectRow[0].cells[1].innerHTML;

// do something

}


But now it does not work...

Can you help me?



Ragavee U S [Syncfusion]
Replied On June 5, 2014 08:27 AM

Hi Jesus

 

We have analyzed your requirement. We have considered that you are asking for ASP.NET MVC code and thus have provided the equivalent ASP.NET MVC code snippet for the one which you have provided.

 

Please refer the below code snippet:

 

<script type="text/javascript">

    function selected(args){

        var gridObj = $("#Grid").data("ejGrid");       

        var selectRow = gridObj.getSelectedRecords();

        if (selectRow != "")

            var id = selectRow[0].OrderID;

        //do something

    }

</script>

 

 

Please get back to us if you require the code in ASP.NET MVC Classic and let us know if you need any further assistance.

 

Regards

 

Ragavee U S


Jesus Sanchez
Replied On June 5, 2014 10:14 AM

Thanks!!!

Another question,
Before when using ASP.net MVC (non-CLASSIC) v. 11.3.0... and changing the datasource (add or edited some registry) of the grid, could update the grid from jquery with grid.sendRefreshRequest (). How I do this now in ASP.net MVC CLASSIC v. 12.1.0..?
I tried with grid.refreshGridContent (false); and grid.refreshGridContent (true); and not work, no update data of the grid ...

Can you help me?

Thanks

Ragavee U S [Syncfusion]
Replied On June 6, 2014 06:12 AM

Hi Jesus

 

The ASP.Net MVC Controls used in Essential Studio v11.4.0.26, is now renamed as ASP.Net MVC (Classic) and the newer set of controls powered by Essential JavaScript takes its place.

 

In the ASP.Net MVC (latest), we don’t have separate DLL for every controls rather we will use “Syncfusion.EJ.MVC.dll” and “Syncfusion.EJ.dll” to hold all the controls in common. And in the ASP.Net MVC (classic), we have separate DLLs for individual controls.

 

Please refer the below Release note of Essential Studio v12.1.0.43.

 

http://files2.syncfusion.com/Installs/v12.1.0.43/ReleaseNotes/ASPMVCClassic.html

 

Could you please tell us know whether you want to use the ASP.Net MVC or  ASP.Net MVC(Classic) ?

 

The Grid control for ASP.NET MVC Classic is initialized as follows:

 

@(Html.Syncfusion().Grid<object>

 

Whereas in current ASP.NET MVC, the grid control is initialized as:

 

@(Html.EJ().Grid<object>

 

The provided information will be helpful for us in providing you response accordingly.

 

In ASP.NET MVC, the grid content can be refreshed using the dataSource() method. Please refer the below code snippet:

 

 

<script>

. . .

var obj = $("#Grid").data("ejGrid");

obj.dataSource(data);//data - data obtained from controller

</script>

 

 

Please let us know if you need any further assistance.

 

Regards

Ragavee U S


Jesus Sanchez
Replied On June 6, 2014 08:01 AM

OK... I was so confused, I use syncfusion ASP.net mvc non-classic.


I tell you what I get:
I have a vista with a (delete) button, a syncfusion grid, then when I pulse button I want to clear the log selected but before confirming the action:     
 

My script in the view:

$('#Delete').on("click", function (e) {

var gridObj = $("#TaxisGrid").data("ejGrid");

var selectRow = gridObj.getSelectedRecords();

if (selectRow != "") {

msgBoxImagePath = "../../images/";

$.msgBox({

title: "Atención",

content: "Estás seguro de eliminar el Registro seleccionado?",

type: "confirm",

buttons: [{ value: "Si" }, { value: "No" }, { value: "Cancelar"}],

success: function (result) {

if (result == "Si") {

var id = selectRow[0].Id;

var url = "/Taxis/DeleteTaxi?id=" + id;

event.preventDefault();

$.ajax({

url: url,

dataType: 'json'

}).done(function (response) {

if (response.success) {

var obj = $("#TaxisGrid").data("ejGrid");

//obj.dataSource(Model); -> I WANT UPDATE THE GRID!!!! HOW????

//gridObj.refreshGridContent(true);

}

});

}

}

});

} else {

msgBoxImagePath = "../../images/";

$.msgBox({

title: "Atención",

content: "Debes seleccionar un registro para poder Borrarlo",

type: "alert"

});

}

});


My controller:

[HttpGet]
public ActionResult DeleteTaxi(int id)

 ManagementDB.DeleteTaxi(id);

 //return (ManagementDB.GetAllTaxi(User.Identity.Name).GridActions<Taxi>());

 return Json(new { success = true }, JsonRequestBehavior.AllowGet);
}


///////////////////

Before with ASP.net mvc classic I do this:

$('#Delete').live("click", function (e) {

var gridObj = $find('VGastosGrid');

var selectRow = gridObj.selectedRows();

if (selectRow != "") {

$.msgbox("Estás seguro de eliminar el Registro seleccionado?", {

type: "confirm",

buttons: [



{ type: "submit", value: "Si" },


{ type: "submit", value: "No" },


{ type: "cancel", value: "Cancelar" }

]



 function (result) {


if (result == "Si") {


var id = selectRow[0].cells[1].innerHTML;


var url = "/Gastos/DeleteGasto?id=" + id;




$.ajax({


url: url,



dataType: 'json'


}).done(function (response) {


if (response.success) {




gridObj.sendRefreshRequest(); // -> THIS WORKS!!!!!


}


});


}


});



} else {


$.msgbox("Debes seleccionar un registro para poder Borrarlo.");




}


});




Jesus Sanchez
Replied On June 9, 2014 12:18 AM

Solved!!!

Thanks!!!


Ragavee U S [Syncfusion]
Replied On June 9, 2014 08:01 AM

Hi Jesus.

 

Thanks for the update.

 

If you have any issues in the future, please get back to us we will be happy to assist you.

 

Please let us know if you would require any further assistance.

 

Regards

Ragavee U 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

;