I would like to create a couple of different edit item templates based on the kind of kind of product the user is editing. I have read several MSDN articles on how to create 'dynamic' templates using classes and I think I get the gist of things. However,
I have a couple of questions that I hope someone can answer and or/or point me to a good tutorial. The current edit item template is shown below. What I want to be able to do is to eliminate specific fields in different templates. Currently I am simply making
fields visible/invisible when the user clicks the 'edit' button but for me this is 'brute force' and not an intellectually satisfying solution nor, I suspect, is it the most efficient way to go about things. <g> Thanks in advance for assistance!
dsutherland
Member
293 Points
74 Posts
Class-based edit item template question
Aug 08, 2006 06:20 PM|LINK
I would like to create a couple of different edit item templates based on the kind of kind of product the user is editing. I have read several MSDN articles on how to create 'dynamic' templates using classes and I think I get the gist of things. However, I have a couple of questions that I hope someone can answer and or/or point me to a good tutorial. The current edit item template is shown below. What I want to be able to do is to eliminate specific fields in different templates. Currently I am simply making fields visible/invisible when the user clicks the 'edit' button but for me this is 'brute force' and not an intellectually satisfying solution nor, I suspect, is it the most efficient way to go about things. <g> Thanks in advance for assistance!
<EditItemTemplate> <asp:Label ID="Label1" runat="server" CssClass="formtexttag" Text="product variant id"></asp:Label><br /> <asp:Label ID="idLabel" runat="server" CssClass="formtext" Text='<%# Bind("product_variant_id") %>'></asp:Label><br /> <asp:Label ID="Label3" runat="server" CssClass="formtexttag" Text="SKU"></asp:Label><br /> <asp:textbox ID="SKULabel" runat="server" enabled = "true" CssClass="formtext" Text='<%# Bind("SKU") %>'></asp:textbox><asp:Label ID="ValidationLabel1" runat="server" cssclass="validationmessage" ></asp:Label><br /> <asp:Label ID="Label4" runat="server" CssClass="formtexttag" Text="size"></asp:Label><br /> <asp:textbox ID="sizeLabel1" runat="server" CssClass="formtext" Text='<%# Bind("size") %>'></asp:textbox><br /> <asp:Label ID="Label6" runat="server" CssClass="formtexttag" Text="size unit"></asp:Label><br /> <asp:DropDownList ID="sizeUnitDropDownList" runat="server" OnDataBinding="SizeUnit_DataBinding" Enabled="true" CssClass="formtext" DataSourceID="sqlDataSource5" DataValueField="id" DataTextField="size_unit" autopostback="true"></asp:DropDownList><br /> <asp:Label ID="Label7" runat="server" CssClass="formtexttag" Text="retail price"></asp:Label><br /> <asp:textbox ID="retailPriceLabel1" runat="server" CssClass="formtext" Text='<%# Bind("retail_price","{0:c}") %>'></asp:textbox><br /> <asp:Label ID="Label10" runat="server" CssClass="formtexttag" Text="image"></asp:Label><br /> <asp:DropDownList ID="DropDownList1" runat="server" OnDataBinding="Image_DataBinding" Enabled="true" CssClass="formtext" DataSourceID="sqlDataSource6" DataValueField="id" DataTextField="display_name" AutoPostBack="true"></asp:DropDownList><br /> <asp:Label ID="Label13" runat="server" CssClass="formtexttag" Text="shipping weight (oz)"></asp:Label><br /> <asp:textbox ID="shippingWeightOz" runat="server" CssClass="formtext" Text='<%# Bind("shipping_weight_oz") %>'></asp:textbox><br /> <asp:Label ID="Label11" runat="server" CssClass="formtexttag" Text="reorder reminder"></asp:Label><br /> <asp:DropDownList ID="reorderReminderDropDownList" runat="server" OnDataBinding="ReorderReminder_DataBinding" Enabled="true" CssClass="formtext" DataSourceID="sqlDataSource7" DataValueField="id" DataTextField="display_name" autopostback="true"></asp:DropDownList><br /> <br /> <asp:CheckBox ID="in_stockCheckBox" runat="server" Checked='<%# Bind("in_stock") %>' Enabled="true" CssClass="formtexttag" Text="in stock" /><br /> <asp:CheckBox ID="orderableCheckBox" runat="server" Checked='<%# Bind("orderable") %>' Enabled="true" CssClass="formtexttag" Text="orderable" /><br /> <asp:CheckBox ID="discountableCheckBox" runat="server" Checked='<%# Bind("discountable") %>' Enabled="true" CssClass="formtexttag" Text="discountable"/><br /> <br /> <asp:Button ID="EditButton" runat="server" enabled="false" cssclass="commandbutton" CommandName="editProductVariant" OnCommand="FormView2_OnCommand" CausesValidation="true" Text="edit"> </asp:Button> <asp:Button ID="UpdateButton" runat="server" cssclass="commandbutton" CommandName="updateProductVariant" OnCommand="FormView2_OnCommand" CausesValidation="true" Text="update"> </asp:Button> <asp:Button ID="UpdateCancelButton" runat="server" cssclass="commandbutton" CausesValidation="False" CommandName="cancel" Text="cancel"> </asp:Button> </EditItemTemplate>