KaxListBoxTemplateNeeded Event |
Occurs before template is being applied to the item.
Namespace: Kettic.AspNet.ControlsAssembly: Kettic.AspNet.Controls (in Kettic.AspNet.Controls.dll) Version: 2014.4.1129.0 (2014.04.1129.0)
Syntaxpublic event KaxListBoxItemEventHandler TemplateNeeded
Public Event TemplateNeeded As KaxListBoxItemEventHandler
public:
event KaxListBoxItemEventHandler^ TemplateNeeded {
void add (KaxListBoxItemEventHandler^ value);
void remove (KaxListBoxItemEventHandler^ value);
}
member TemplateNeeded : IEvent<KaxListBoxItemEventHandler,
KaxListBoxItemEventArgs>
Value
Type:
Kettic.AspNet.ControlsKaxListBoxItemEventHandler
Remarks
The TemplateNeeded event is raised before a template is been applied on the item,
both during round-trips (postbacks) and at the time data is bound to the control. The TemplateNeeded event is not raised for items
which are defined inline in the page or user control.
The TemplateNeeded event is commonly used for dynamic templating.
Examples
The following example demonstrates how to use the
TemplateNeeded event
to apply templates with respect to the
Value property of the items.
protected void KaxListBox1_TemplateNeeded(object sender, Kettic.AspNet.Controls.KaxListBoxItemEventArgs e)
{
string value = e.Item.Value;
if (value != null)
{
if ((Int32.Parse(value) % 2) == 0)
{
var textBoxTemplate = new TextBoxTemplate();
textBoxTemplate.InstantiateIn(e.Item);
}
}
}
Sub KaxListBox1_Template(ByVal sender As Object, ByVal e As Kettic.AspNet.Controls.KaxListBoxItemEventArgs) Handles KaxListBox1.TemplateNeeded
Dim value As String = e.Item.Value
If value IsNot Nothing Then
If ((Int32.Parse(value) Mod 2) = 0) Then
Dim textBoxTemplate As TextBoxTemplate = New TextBoxTemplate()
textBoxTemplate.InstantiateIn(e.Item)
End If
End If
End Sub
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
See Also