0

I want to add a link to EJ TreeGrid and I want pass the column's on href.

col.Field("NoteID")
                      .HeaderText("View")
                      .Width(80)
                      .TextAlign(TextAlign.Right)
                      .IsTemplateColumn(true)
                      .Template("<a href='" + @Url.Action("GetNoteID", "Notes") + "/" + "/{NoteID}' target='_blank'>View Broker Note</a>")                     
                      .Add();

How can I pass the pass NoteID on {NoteID} in the href link?

I tried:

.ClientSideEvents(eve =>
                  {
                     eve.QueryCellInfo("querycellinfo");
                  })`

`function querycellinfo(args) {
        if (args.column.field === "NoteID" && args.cellValue != null) {
            $(args.cellElement).find(".linkbtn").click(function () {
                $.ajax({
                    type: "GET",
                    url: @Url.Action("GetNoteID", "Notes") + "/" + args.cellValue,
                    data: args.data,
                    dataType: "json"
                });
            })
        }
    }

but with no luck.

1 Answer 1

0

To address your requirement, we have provided a sample where we used template in the column to provide a hyperlink and passed the taskname value using double curly braces with Colon {{: }}, you can find the code snippet and sample Link below

Code Snippet:

/index.cshtml/

.Columns(co =>

{

 co.Field("TaskName").HeaderText("Task Name").EditType(TreeGridEditingType.String).Template("<a href='" + @Url.Action("GetNoteID", "Notes") + "/" + "/{{:TaskName}}' target='_blank'>View Broker Note</a>").IsTemplateColumn(true).Add();

}

Sample Link : https://www.syncfusion.com/downloads/support/directtrac/general/ze/TestSample1393020514

UG LINK : https://help.syncfusion.com/aspnetmvc/treegrid/columns#column-template

Regards,

Udhayakumar

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.