DataRepeater.EndResetItemTemplate Method ()


Ends a code block that enables you to reset the ItemTemplate for a DataRepeater control.

Namespace:   Microsoft.VisualBasic.PowerPacks
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

public void EndResetItemTemplate()

Use this method when you want to reset properties of an ItemTemplate at run time. This method must be preceded by the BeginResetItemTemplate method to open the block.

The following example demonstrates how to call the BeginResetItemTemplate and EndResetItemTemplate methods in the LayoutStyleChanged even handler of a DataRepeater control. This example requires that you have a DataRepeater control named DataRepeater1 on a form and that it contain two TextBox controls named TextBox1 and TextBox2.

private void dataRepeater1_LayoutStyleChanged_1(object sender, EventArgs e)
    // Call a method to re-initialize the template.
    if (dataRepeater1.LayoutStyle == DataRepeaterLayoutStyles.Vertical)
    // Change the height of the template and rearrange the controls.
        dataRepeater1.ItemTemplate.Height = 150;
        dataRepeater1.ItemTemplate.Controls["TextBox1"].Location = new Point(20, 40);
        dataRepeater1.ItemTemplate.Controls["TextBox2"].Location = new Point(150, 40);
        // Change the width of the template and rearrange the controls.
        dataRepeater1.ItemTemplate.Width = 150;
        dataRepeater1.ItemTemplate.Controls["TextBox1"].Location = new Point(40, 20);
        dataRepeater1.ItemTemplate.Controls["TextBox2"].Location = new Point(40, 150);
    // Apply the changes to the template.
Return to top