Grid Column Url.Action and multiple parameters

7 posts, 1 answers
  1. Jeff
    Jeff avatar
    20 posts
    Member since:
    Jul 2015

    Posted 28 Sep 2015 Link to this post

    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.

     

     

  2. Answer
    Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 30 Sep 2015 Link to this post

    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
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Jeff
    Jeff avatar
    20 posts
    Member since:
    Jul 2015

    Posted 30 Sep 2015 in reply to Rosen Link to this post

    Works perfectly :-)
  5. Raul
    Raul avatar
    15 posts
    Member since:
    Apr 2016

    Posted 25 Jul in reply to Rosen Link to this post

    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.


     

  6. Raul
    Raul avatar
    15 posts
    Member since:
    Apr 2016

    Posted 25 Jul in reply to Rosen Link to this post

    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.

  7. Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 26 Jul Link to this post

    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
  8. Raul
    Raul avatar
    15 posts
    Member since:
    Apr 2016

    Posted 26 Jul in reply to Rosen Link to this post

    Hello Rosen,

    Thank you so much. It works fine.

    Best Regards.

    Raúl

     

     

Back to Top
UI for ASP.NET MVC is VS 2017 Ready