To make it easier to create a specific form, we use a modified Formview control that is inside the user control. This user control is intended for the grid and FormView, you can select the element in the grid, and FormView is presented in a modal view for viewing / editing:
<I2CL:Grid runat="server" ID="Grid" OnSelecting="Selecting" ShowCreate="true" />
<I2:Modal ID="SFModal" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<I2:FormView runat="server" ID="FVSubForm" DefaultMode="Edit" DataSourceID="DSSubForm" />
<I2:ILDataSource ID="DSSubForm" runat="server" />
</ContentTemplate>
</I2:Modal>
On the page, the control looks like this:
<I2C:TabGrid ID="TG" runat="server" Property="ParentProperty">
<Columns>
<I2:Column Header="Column 1" DataSource="Column1" />
<I2:Column Header="Column 2" DataSource="Column2" />
</Columns>
<EditItemTemplate>
<I2Form:Dropdown ID="Col1" runat="server" SelectedValue='<%# Bind("Column1") %>' List="Column1Options" />
<I2Form:Textbox ID="Col2" runat="server" Text='<%# Bind("Column2") %>' />
</EditItemTemplate>
</I2C:TabGrid>
The problem is that we are using EditItemTemplate. The only way to figure out how to connect it is to have an ITemplate in the TabGrid control and apply the link in OnInit:
[PersistenceMode(PersistenceMode.InnerProperty),
TemplateContainer(typeof(FormView))]
public ITemplate EditItemTemplate { get; set; }
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
FVSubForm.EditItemTemplate = EditItemTemplate;
}
, , , EditItemTemplate, FormView , , , , , .
I2: ILDataSource, , , ObjectDataSource. GetEntity() ( ) UpdateEntity(obj Entity) . , 90% ObjectDataSource.
, , <EditItemTemplate> <I2C:TabGrid> <EditItemTemplate> <I2:FormView>. , ?
. EditItemTemplate FVSubForm , , , FVSubForm null. , , , .