View Full Version : [CLOSED] XTemplate + custom javascript function

Feb 03, 2013, 12:04 AM

I would like to replace the REFERENCE_CLUB by the related club name from an existing store.

I tryied this way but doesnt work.

<ItemTpl runat="server">
<tpl for=".">
<div class="list-item" id="{ID}">
<div class="Warn">{REFERENCE_CLUB:ClubRenderer}</div>

How can I call a javascript function?

Thank you

Feb 03, 2013, 1:03 AM

Take a look at the following example:

<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
List<Parent> parents = new List<Parent>(3);

for (int i = 0; i < 3; i++)
Parent parent = new Parent();
parent.Name = "Parent" + i;


this.ObjHolder1.Items.Add("parents", parents);

public class Parent
public string Name { get; set; }

<!DOCTYPE html>

<head runat="server">
<title>Ext.NET Examples</title>

var myFunction = function (name) {
return name + '_changed';
<form runat="server">
<ext:ResourceManager runat="server" />

<ext:ObjectHolder ID="ObjHolder1" runat="server" />

<ext:XTemplate ID="XTemplate1" runat="server">
<ext:JFunction Name="MyFunction" Fn="myFunction" />
<p>Name: {Name}</p>

<ext:Panel runat="server" >
<Render Handler="#{XTemplate1}.overwrite(this.body, #{ObjHolder1}.parents[0]);" />

Feb 03, 2013, 10:43 AM

Yous support is like the Tina Turner's song : "Simply the best"

Any workaround for calling a js function in a <ItemTpl> used in a combobox?

It doesn't support custom functions as shown in you previous post.

Thank you.

Feb 03, 2013, 8:22 PM
Just define js function in the page and use it inside template without 'this'