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. Image for the cookie policy date

Problem with refresh partial views

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

14 Replies

RU Ragavee U S Syncfusion Team June 2, 2014 04:38 PM UTC

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


JS Jesus Sanchez June 2, 2014 05:21 PM UTC

Thank you
waiting for resolution.


JS Jesus Sanchez June 2, 2014 05:59 PM UTC

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


RU Ragavee U S Syncfusion Team June 3, 2014 10:24 AM UTC

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



JS Jesus Sanchez June 3, 2014 04:34 PM UTC

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


RU Ragavee U S Syncfusion Team June 4, 2014 12:32 PM UTC

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


JS Jesus Sanchez June 4, 2014 03:19 PM UTC

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





JS Jesus Sanchez June 4, 2014 03:25 PM UTC

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?




RU Ragavee U S Syncfusion Team June 5, 2014 12:27 PM UTC

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



JS Jesus Sanchez June 5, 2014 02:14 PM UTC

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


RU Ragavee U S Syncfusion Team June 6, 2014 10:12 AM UTC

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.

 

https://s3.amazonaws.com/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



JS Jesus Sanchez June 6, 2014 12:01 PM UTC

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.");




}


});





JS Jesus Sanchez June 9, 2014 04:18 AM UTC

Solved!!!

Thanks!!!



RU Ragavee U S Syncfusion Team June 9, 2014 12:01 PM UTC

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


Loader.
Live Chat Icon For mobile
Up arrow icon