P
pjbates
Hi,
I've been using the GridView and DetailsView controls for a while, and
I'm beginning to get annoyed by the redundancy of EditItemTemplate and
InsertItemTemplate in many cases.
In the following code, both edit and insert templates are identical. It
would be great if I could define a generic template to be used for both
edits and inserts. I know that there are many situations where the edit
and insert templates will differ, but for the simple cases it would be
nice to use a single template.
Is there a work around for this?
Thanks
<asp:TemplateField HeaderText="EndDate" SortExpression="EndDate">
<ItemTemplate>
<asp:Label ID="Label_EndDate" runat="server"
Text='<%# Bind("EndDate") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="TextBox_EditEndDate"
runat="server" Text='<%# Bind("EndDate") %>' />
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox_InsertEndDate"
runat="server" Text='<%# Bind("EndDate") %>' />
</InsertItemTemplate>
</asp:TemplateField>
Peter
I've been using the GridView and DetailsView controls for a while, and
I'm beginning to get annoyed by the redundancy of EditItemTemplate and
InsertItemTemplate in many cases.
In the following code, both edit and insert templates are identical. It
would be great if I could define a generic template to be used for both
edits and inserts. I know that there are many situations where the edit
and insert templates will differ, but for the simple cases it would be
nice to use a single template.
Is there a work around for this?
Thanks
<asp:TemplateField HeaderText="EndDate" SortExpression="EndDate">
<ItemTemplate>
<asp:Label ID="Label_EndDate" runat="server"
Text='<%# Bind("EndDate") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="TextBox_EditEndDate"
runat="server" Text='<%# Bind("EndDate") %>' />
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox_InsertEndDate"
runat="server" Text='<%# Bind("EndDate") %>' />
</InsertItemTemplate>
</asp:TemplateField>
Peter