This is a migrated thread and some comments may be shown as answers.

Require Confirmation Message box on delete based on the service response

0 Answers 19 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
A
Top achievements
Rank 1
A asked on 06 Jan 2012, 09:17 AM

Hi All,

I am using telerik razor grid wherein i have an option to delete or deactivate the records.  on click of delete, i am calling the actionResult which inturn calls the service and returns bool value based on the conditions (like, if there is a reference to this record, then it gives me isDelete = false).  If i get false, then I need to show the confirmation message box saying that "You can deactivate instead of delete since there is a reference. do you want to continue" along with OK and Cancel buttons.  On click of Ok, it should continue the action by calling the service again else on click of cancel it should ignore.  Can anyone help me on on this.  if possible without jQuery.


View:  Tellerik grid and below code is written in .RowTemplate(grid => @<text>
=================================================================

@{

 

 

if (item.IsActive.Value)

 

{

 

 

<div align="center">
<
a title="Delete" onclick="return confirm('Are you sure to delete');"
href=@Url.Action("DeleteComplaint", "Complaint", new { id = @item.ComplaintId, CN = Model.CN, CC = Model.CC, IA = Model.IA, SN = Model.SN, Gridpage = this.Request.QueryString["Grid-page"] ?? this.Request.QueryString["Gridpage"]})>
<
div class="emr9_close_img"></div></a> </div>

 

}

 

 

else

 

{

 

 

<div align="center">
<
a title="Reactivate" onclick="return confirm('Are you sure to reactivate');"
href=@Url.Action("ReActiveComplaint", "Complaint", new { id = @item.ComplaintId, CN = Model.CN, CC = Model.CC, IA = Model.IA, SN = Model.SN, Gridpage = this.Request.QueryString["Grid-page"] ?? this.Request.QueryString["Gridpage"]})><div class="emr9_curvedarrow_img">
</
div></a> </div>

 

}

}



Controller:
=========

public

 

 

ActionResult DeleteComplaint(Guid? id, string CN, bool? CC, bool? IA, string SN, int? Gridpage, string GridorderBy)

 

{

 

 

bool isDelete = complaintService.DeleteComplaint(id.Value);

 

 

 

if (!isDelete)

 

{

 

 

//Need show Confirmation message for Deactivating the record.

 

 

 

//On Click of Ok - I will call the service

 

 

 

//On click of Cancel - It should ignore it

 

}

 

 

ComplaintSearchViewModel searchMmodel = new ComplaintSearchViewModel();

 

searchMmodel.CN = CN;

searchMmodel.CC = CC;

searchMmodel.IA = IA;

searchMmodel.SN = (SN ==

 

null || SN.ToLower() == "all") ? null : SN;

 

searchMmodel.Gridpage = Gridpage;

searchMmodel.GridorderBy = GridorderBy;

 

 

return RedirectToAction("MasterComplaints", "Complaint", GetRoutingParameters(searchMmodel));

 

 

}

Thanq in advance.

Tags
General Discussions
Asked by
A
Top achievements
Rank 1
Share this question
or