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

Grid Column Url.Action and multiple parameters

6 Answers 2001 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 28 Sep 2015, 07:52 PM

Hello.

 I have been googling this all day to no avail.  I need to add a third parameter to the following:

columns.Bound(p => p.Line).ClientTemplate(
    "<a href='" +
    Url.Action("Details", "OrderLine") +
    "?OrdId=#= OrdId #&Line=#=Line#'" +
    ">#=Line#</a>"
);

 

I have tried different combinations and none have seemed to pass the third parameter to the details screen (OrdType is the parameter).  I can pass two of the parameters using the above, but I am not sure how to pass the third.  I appreciate any help.

Thank you.

 

 

6 Answers, 1 is accepted

Sort by
0
Accepted
Rosen
Telerik team
answered on 30 Sep 2015, 02:25 PM

Hello Jeff,

You should be able to construct the URL the same way as in the code snippet:

 

columns.Bound(p => p.ContactName).ClientTemplate(
    "<a href='" +
    Url.Action("Details", "OrderLine") +
    "?OrdId=#= OrdId #&Line=#=Line#&OrdType=#=OrdType#'" +
    ">#=Line#</a>"
);

 

Regards,
Rosen
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Jeff
Top achievements
Rank 1
answered on 30 Sep 2015, 02:26 PM
Works perfectly :-)
0
Raul
Top achievements
Rank 1
answered on 25 Jul 2016, 10:10 AM

Dear Telerik's developers,

This is my definition of column in my view:

        columns.Bound(c => c.Profile.Name).Width(200).Filterable(ftb => ftb.Multi(true).Search(true)).ClientTemplate(
                "<a href=' " + Url.Action("AssessmentProcessCompetence", "Assessment") + "/#: AssessmentId #'" + ">#: Profile.Name #</a>").HeaderHtmlAttributes(new { style = "overflow: visible; white-space: normal" }).Title("Profile Names");

Currently, I am passing one parameter (AssessmentId) to the controller (AssessmentController ). I would like to pass a new parameter in the definition of column in order to allow to edit or not based on this parameter. This parameter could be a boolean (true or false).

This is my procedure in AssessmentController :

        public ActionResult AssessmentProcessCompetence(Guid id)
        { ... }

I would like to retrieve the new parameter as :

        public ActionResult AssessmentProcessCompetence(Guid id, bool AllowEdit)
        { ... }

 

Could you please help me in this issue?

 

Best Regards.

Raúl.


 

0
Raul
Top achievements
Rank 1
answered on 25 Jul 2016, 10:29 AM

Dear Telerik's developers,

This is my definition of one of my columns in my view :

        columns.Bound(c => c.Profile.Name).Width(200).Filterable(ftb => ftb.Multi(true).Search(true)).ClientTemplate(
                "<a href=' " + Url.Action("AssessmentProcessCompetence", "Assessment") + "/#: AssessmentId #'" + ">#: Profile.Name #</a>").HeaderHtmlAttributes(new { style = "overflow: visible; white-space: normal" }).Title("Profile Names");

As you can see ... I am passing one parameter to the controller (AssessmentId). I would like to pass another parameter to the procedure in order to allow to edit or not based on this parameter. 

Currently, this is my definition in the controller :

        public ActionResult AssessmentProcessCompetence(Guid id)
        {..}

and I would like to have something like this:

        public ActionResult AssessmentProcessCompetence(Guid id, bool AllowEdit)
        {...]

Could you please help me and say me how I define this new parameter in the column definition?

Best Regards.

Raúl.

0
Rosen
Telerik team
answered on 26 Jul 2016, 06:30 AM

Hello Raul,

Did you try the approach discussed previously in this thread. You should be able to declare the parameters as part of the QueryString of the URL. Similar to the following: 

Url.Action("AssessmentProcessCompetence", "Assessment") + "?id=#: AssessmentId#&allowedit=#:allowEdit#"

Regards,
Rosen
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Raul
Top achievements
Rank 1
answered on 26 Jul 2016, 06:57 PM

Hello Rosen,

Thank you so much. It works fine.

Best Regards.

Raúl

 

 

Tags
Grid
Asked by
Jeff
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Jeff
Top achievements
Rank 1
Raul
Top achievements
Rank 1
Share this question
or