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

[Solved] Override cancel url

2 Answers 137 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.
ori
Top achievements
Rank 1
ori asked on 20 Jan 2012, 01:33 PM
Hi ,

I have implemented grid control in my MVC application.
url to the grid page : ~/controller/action/2
when i edit a record and want to cancel the edit he send me back to: ~/controller/action/

how can i override the url with extra {id=Model.id,} so the result will be: /controller/action/2 ?

Thank you

Ori

2 Answers, 1 is accepted

Sort by
0
Siva
Top achievements
Rank 1
answered on 28 Mar 2012, 10:35 AM
Dear Telerik Team,

Do you have any updates for this. I am having similar issue.
The Cancel button URL is missing few parameters to Controller Action.
The Edit button URL is
http://localhost:1065/ProcessClaim/ShowDetails?clientId=Client_01&claimId=TS234H3&importTransactionId=21&ClaimLines-mode=edit&claimNumber=TS234H3&assignedNumber=1

The Cancel button URL is
http://localhost:1065/ProcessClaim/ShowDetails?claimId=TS234H3
As you can see the parameters clientId and importTransactionId are missing for Cancel button

Could you please explain this behavior

BTW this is my grid declaration

@(Html.Telerik().Grid(Model.ClaimLines)
               .Name("ClaimLines")
               .DataKeys(kf =>
                             {
                                 kf.Add(cl => cl.ClientId).RouteKey("clientId");
                                 kf.Add(cl => cl.ClaimNumber).RouteKey("claimNumber");
                                 kf.Add(cl => cl.AssignedNumber).RouteKey("assignedNumber");
                                 kf.Add(cl => cl.ImportTransactionId).RouteKey("importTransactionId");
                             })
               .Columns(columns =>
                            {
                                columns.Bound(cl => cl.DOSFrom).ReadOnly();
                                columns.Bound(cl => cl.DOSTo).ReadOnly();
                                columns.Bound(cl => cl.POS).ReadOnly();
                                columns.Bound(cl => cl.CPT).ReadOnly();
                                columns.Bound(cl => cl.Mod1).ReadOnly();
                                columns.Bound(cl => cl.Mod2).ReadOnly();
                                columns.Bound(cl => cl.Mod3).ReadOnly();
                                columns.Bound(cl => cl.Mod4).ReadOnly();
                                columns.Bound(cl => cl.Description).ReadOnly();
                                columns.Bound(cl => cl.Charge).ReadOnly();
                                columns.Bound(cl => cl.Units).ReadOnly();
                                columns.Bound(cl => cl.Allowed).ReadOnly();
                                columns.Bound(cl => cl.RepricedAmount);
                                columns.Bound(cl => cl.Source);
                                columns.Bound(cl => cl.ImportTransactionId).Hidden();
                                columns.Command(cf => cf.Edit());
                            })
               .DataBinding(dataBinding =>
                    dataBinding
                        .Server()
                        .Update("UpdateClaim", "ProcessClaim")
                                        .Select("ShowDetails", "ProcessClaim", new { clientId = Model.ClientId, claimId = Model.ClaimNumber, importTransactionId = Model.ImportTransactionId })
        )
      )

And this is my Controller Action method signature
public ViewResult ShowDetails(string clientId, string claimId, long importTransactionId)

Thanks,
Siva
0
Siva
Top achievements
Rank 1
answered on 28 Mar 2012, 02:46 PM
It works for me now.
I am still not sure how but it does work now.
I just modified the DataKeys part
.DataKeys(kf =>
                             {
                                 kf.Add(cl => cl.ClientId).RouteKey("clientId2");
                                 kf.Add(cl => cl.ClaimNumber).RouteKey("claimId2");
                                 kf.Add(cl => cl.AssignedNumber).RouteKey("assignedNumber");
                                 kf.Add(cl => cl.ImportTransactionId).RouteKey("importTransactionId2");
                             })
The difference is I just added 2 at the end of 3 of the RouteKey parameters
May be you can answer this mystery for me

Thanks,
Siva
Tags
Grid
Asked by
ori
Top achievements
Rank 1
Answers by
Siva
Top achievements
Rank 1
Share this question
or