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

[Solved] change DataRouteValues in Javascript + Ajax Call

7 Answers 150 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Dipak
Top achievements
Rank 1
Dipak asked on 01 May 2012, 04:47 PM
Hi,

I have Custom Command like below.

commands.Custom("CustomDelete").Text("Delete").Action("_DeleteKit", "Kit").Ajax(true);

and Javascript like :
function onRowBound(e) {
            $(e.row).find('a.t-grid-CustomDelete').click(function (e)
            {
                if (confirm('Are you sure?')) {
                    return true;
                } else { return false; }
               });
        }

 

 

Now, i need another yes/no confirmation in first confirm like "Is it Billable?" If yes then i have change RouteValue with any one parameter said it 'yes' and send it back to controller to do other stuff based on it.

Any idea??

Thanks

 

 


7 Answers, 1 is accepted

Sort by
0
Andy McShane
Top achievements
Rank 1
answered on 26 Jun 2012, 11:45 AM
I am trying to achieve the same thing, does anyone have any suggestions?
0
Dipak
Top achievements
Rank 1
answered on 26 Jun 2012, 04:04 PM
I didn't get any answer for it so for the time being i have made two command button seperately.
0
Andy McShane
Top achievements
Rank 1
answered on 26 Jun 2012, 04:05 PM
Hi, thanks for the reply, would you be able to share your solution with me, it sounds ideal?
0
Dipak
Top achievements
Rank 1
answered on 26 Jun 2012, 04:18 PM

On Grid Command :
      

columns.Command(commands =>
{
//commands.Delete().ButtonType(GridButtonType.ImageAndText);
commands.Custom("CustomDelete").Text("Cancel").Action("_DeleteKit", "Kit", new { isBillable = false}).Ajax(true);
commands.Custom("CustomDelete").Text("Cancel & Bill").Action("_DeleteKit", "Kit", new { isBillable = true }).Ajax(true);
}).Width(200).Title("Commands");

                                                                                                                                                                                                                                                                                                                                                                          
Client Event : If you want to change message

function onRowBound(e) {
    $(e.row).find('a.t-grid-CustomDelete').click(function (e) {
        if (confirm('Are you sure want to delete this Job?')) {
 
            return true;
        } else { return false; }
    });
}

Controller:

[GridAction(EnableCustomBinding = true)]
       public ActionResult _DeleteKit(int? id, GridCommand command, bool isBillable, int? KitId)
       {
            // Do whatever you want to do it over here
         }


0
Andy McShane
Top achievements
Rank 1
answered on 26 Jun 2012, 04:19 PM
Excellent, thanks very much for your help!
0
Dipak
Top achievements
Rank 1
answered on 26 Jun 2012, 04:20 PM
hey, if this code helps you then do not forgot to "Mark as Asnwer" ;)
0
Andy McShane
Top achievements
Rank 1
answered on 26 Jun 2012, 04:21 PM
Ooops, of course! :-)


Hmmm, now why can I not see the 'Mark as Answer' option?
Tags
Grid
Asked by
Dipak
Top achievements
Rank 1
Answers by
Andy McShane
Top achievements
Rank 1
Dipak
Top achievements
Rank 1
Share this question
or