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

Pass property from data to Helper function inside TabStrip Item

2 Answers 188 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 31 Dec 2018, 02:49 PM

 

Hi, inside a TabStrip item (which is inside a Grid detail template) I need to call a Helper function and pass some property from the TabStrip's parent Master to it.

@(Html.Kendo().TabStrip()
      .Name("TabStripsEliXer#=idTotaalBeoordeling#")
      .SelectedIndex(0)
      .Animation(animation => animation.Open(effect => effect.Fade(FadeDirection.In)))
      .Items(tabstrip =>
            {
              tabstrip.Add().Text("IdentiteitTab").Selected(true).Content(@<text>
                  <div id="pdf" style="width:70%;height:500px;">
                   @using Elixer_Bekostiging.Helpers
                   @XtendisHelper.GetPDF_BPVO(SomeProperty)
                  </div>

 

SomeProperty needs to be the ID of a document that exists in the Master Grid data, for example 486629 as shown in the attached screenshot. 
GetPDF_BPVO expects an integer and returns a PDF as <object> stream (string). How can I pass the DocumentID (486629) to this Helper?
When I hardcode the value it is working as expected, now I need it to be dynamic :-)

Preferably this must be like "Get me the DocumentID from this selected row's Master property xtendisdocumentPerStamnummers where SoortDocument = B".

N.B. The other SoortDocument types (O and I) are needed inside another TabStrip Item.

TIA,

Peter

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 01 Jan 2019, 03:41 PM
Hi Peter,

The server data (@XtendisHelper.GetPDF_BPVO(SomeProperty)) needs to be resolved on the server, so this must happen when the view is rendering. The server wrappers ultimately boil down to the Kendo UI jQuery widgets, so you end up having a client template that is actually rendered in the browser, so it will not render a new instance for each row that can contain different server settings.

I'd encourage you to create the detail contents in the detailInit event as done in this demo: https://demos.telerik.com/kendo-ui/grid/detailtemplate.

Here's a basic example of getting data from the parent: https://dojo.telerik.com/@bratanov/UrABIFAv

here's how to hook this event to an MVC wrapper initialization

@(Html.Kendo().Grid<someModel>()
                        .Name("grid")
                        .Events(ev => ev.DetailInit("detailInitHandler"))
)


Regards,
Marin Bratanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Peter
Top achievements
Rank 1
answered on 04 Jan 2019, 08:18 PM

Hi Marin, thank you. I've managed to get it done by using the RequestEnd event of the ListView that resides in the Grid => detail row => TabStrip => Item. When this event fires, I pass the ID of the PDF (that is also in the ViewModel for the ListView) to a jQuery function that calls the controller action that gets the PDF stream. This is working. I'll keep your solution for future references.

Beste regards,

Peter

Tags
TabStrip
Asked by
Peter
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Peter
Top achievements
Rank 1
Share this question
or