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

how to show dialog box after returning from controller's action method.

Thread ID:

Created:

Updated:

Platform:

Replies:

127364 Nov 10,2016 09:37 AM UTC Nov 14,2016 05:01 AM UTC ASP.NET MVC 3
loading
Tags: Grid
FIT
Asked On November 10, 2016 09:37 AM UTC

Hello,

I recently started using syncfusion grid and not able to figure out how to show a dialog box after any insert ,delete or update event. I am using InertURL ,UpdateURL and RemoveURL function to save data to my database. i am looking for something like Ajax onSuccess() method which gets triggered after a ajax call. how do i achieve this  using syncfusion InsertUrl() and other methods.
this is how my grid looks like.

 @(Html.EJ().Grid<Designation>("FlatGrid")
        .Datasource(ds => ds.Json((IEnumerable<object>)ViewBag.dataSource).InsertURL(Url.Action("DialogInsert", "DesignationMaster", null, Request.Url.Scheme)).UpdateURL(Url.Action("UpdateQuestion", "DesignationChange", null, Request.Url.Scheme)).RemoveURL("DeleteQuestion").Adaptor(AdaptorType.RemoteSaveAdaptor))
        .EnableAltRow()
        .AllowFiltering()
        .AllowSorting()
        .GridLines(GridLines.Horizontal)
        .EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing().ShowConfirmDialog(true).EditMode(EditMode.DialogTemplate).DialogEditorTemplateID("#template"); })
        .ContextMenuSettings(contextMenu =>
        {
            contextMenu.EnableContextMenu();

        })
         .PageSettings(page =>
         {
             page.PageSize(15);
         })
         .AllowTextWrap()
         .AllowResizeToFit()
         .EnableHeaderHover()
         .FilterSettings(filter => { filter.FilterType(FilterType.Excel); })
         .AllowPaging()
         .ClientSideEvents(eve =>
         {
      
             eve.ActionComplete("complete");
             eve.RecordClick("recordClick");
             eve.RecordDoubleClick("recordDoubleClick");       
             eve.ActionBegin("beginAction");

         })
         .ToolbarSettings(toolbar =>
         {
             toolbar.ShowToolbar().ToolbarItems(items =>
             {
                 items.AddTool(ToolBarItems.Add);
                 items.AddTool(ToolBarItems.Edit);
                 items.AddTool(ToolBarItems.Delete);
                 items.AddTool(ToolBarItems.Update);
                 items.AddTool(ToolBarItems.Cancel);
                 items.AddTool(ToolBarItems.Search);
             });
         })
         .Columns(col =>
         {

             col.Field(p => p.designationCode).HeaderText("Designation Code").IsPrimaryKey(true).TextAlign(TextAlign.Left).ValidationRules(v => v.AddRule("required", true).AddRule("number", true)).Width(70).Add();
             col.Field(p => p.description).HeaderText("Description").Width(90).ValidationRules(v => v.AddRule("required", true).AddRule("minlength", 3)).Add();
             col.Field(p => p.salaryDesc).HeaderText("Salary Type").EditType(EditingType.Dropdown).Width(65).Add();
             col.Field(p => p.salaryCode).HeaderText("Salary Type").EditType(EditingType.Dropdown).Width(65).Visible(false).Add();

             col.Field(p => p.normalWokringHrs).HeaderText("Salary Type").Width(65).Visible(false).Add();
             col.Field(p => p.ramadanWorkingHrs).HeaderText("Salary Type").Width(65).Visible(false).Add();
             col.Field(p => p.dailyRate).HeaderText("Salary Type").Width(65).Visible(false).Add();
             col.Field(p => p.hourlyRate).HeaderText("Salary Type").Width(65).Visible(false).Add();

             col.Field(p => p.otAllowed).HeaderText("O.T.").Width(40).EditType(EditingType.Boolean).ValidationRules(v => v.AddRule("required", true).AddRule("minlength", 3)).Add();
             col.Field(p => p.jobCategoryCode).HeaderText("JCC").EditType(EditingType.Dropdown).Width(55).Add();

             col.Field(p => p.jobCategoryDesc).HeaderText("JCD").Width(85).ValidationRules(v => v.AddRule("required", true).AddRule("minlength", 3)).Add();
         })


        )

and this is my dialog box

 <div class="control">

            @(Html.EJ().Dialog("ErrorList").ShowOnInit(false)
        .ContentTemplate(
            @<div class="cnt">
                Do you really leave the session?
            </div>
            )
        .Title("Error List")
        .Animation(animate => animate.Show(show => show.Duration(500).Effect("slide")).Hide(hide => hide.Duration(500).Effect("fade")))
        .ShowFooter().FooterTemplateId("sample")
            )

        </div>


my controller returns a Serialized list of errors if some error occurs while performing server side operation. please tell me where should i write $("#ErrorList").ejDialog("open") function in script to show these errors.

Thanks.



Isuriya Rajan [Syncfusion]
Replied On November 11, 2016 12:28 PM UTC

  
Hi Fit, 

Thanks for contacting Syncfusion support, 

Please refer the below online sample link for dialogTemplate: 


Please refer the below link for remoteSaveAdaptor: 


In grid we have  event called actionFailure this will trigger when grid action getting failed. For your show error message requirement we suggest to use this actionFailure event in client side. 

Please refer the below  sample and documentation link about action failure: 


If we misunderstood your requirement please get back to us. 

Regards, 

Isuriya R 



FIT
Replied On November 13, 2016 08:32 AM UTC

Hello Isuriya,

Thank you so much for your help. I am glad it worked.

Regards,
Sachin


Karthick Kuppusamy [Syncfusion]
Replied On November 14, 2016 05:01 AM UTC

Hi Sachin, 

Thanks for the update. 

We are happy to hear that your requirement is achieved. 

Regards, 
K.Karthick. 


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

;