Answered by:
Dynamic Data insert template

Question
-
User-902880243 posted
I've created a page that houses three tables in gridviews. Just wondering if there was a way to invoke the dynamic insert template for each of these tables rather than me having to create them (they are the same tables that are in the dynamic list of tables but they're just in one page). They must be available programatically if I can get the context right before I invoke them?
Here is the page so far:
<%
@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="AnotherTemp.aspx.vb" Inherits="AnotherTemp" %><
asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:DropDownList ID="drpContracts" runat="server" AutoPostBack="True" DataSourceID="ldsContracts" DataTextField="Contract" DataValueField="Contract"> </asp:DropDownList> <asp:GridView ID="grdContractRoutes" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="ContractRouteID" DataSourceID="ldsContractRoutes" CssClass=gridview Width="287px"> <selectedrowstyle backcolor = "khaki" /> <Columns> <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowSelectButton="True" /> <asp:BoundField DataField="ContractRouteID" HeaderText="ContractRouteID" InsertVisible="False" ReadOnly="True" SortExpression="ContractRouteID" visible="false"/> <asp:BoundField DataField="Contract" HeaderText="Contract" SortExpression="Contract" visible="false"/> <asp:BoundField DataField="Route" HeaderText="Routes" SortExpression="Route" /> </Columns> </asp:GridView> <asp:GridView ID="grdContractVariations" runat="server" AutoGenerateColumns="False" DataKeyNames="ContractVariationID" DataSourceID="ldsContractVariations" CssClass=gridview> <selectedrowstyle backcolor = "khaki" /> <Columns> <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowSelectButton="True" /> <asp:BoundField DataField="ContractVariationID" HeaderText="ContractVariationID" InsertVisible="False" ReadOnly="True" SortExpression="ContractVariationID"/> <asp:BoundField DataField="Contract" HeaderText="Contract" SortExpression="Contract"/> <asp:BoundField DataField="Variation" HeaderText="Variation" SortExpression="Variation" /> <asp:BoundField DataField="Version" HeaderText="Version" SortExpression="Version" /> <asp:BoundField DataField="DeductionFigure" HeaderText="DeductionFigure" SortExpression="DeductionFigure" /> <asp:BoundField DataField="EffectiveFrom" HeaderText="EffectiveFrom" SortExpression="EffectiveFrom" /> <asp:BoundField DataField="EffectiveTo" HeaderText="EffectiveTo" SortExpression="EffectiveTo" /> <asp:BoundField DataField="Reason" HeaderText="Reason" SortExpression="Reason" /> <asp:BoundField DataField="PeriodContractPayment" HeaderText="PeriodContractPayment" SortExpression="PeriodContractPayment" /> <asp:BoundField DataField="ScheduledInServiceMileage" HeaderText="ScheduledInServiceMileage" SortExpression="ScheduledInServiceMileage" /> <asp:BoundField DataField="ContractPrice" HeaderText="ContractPrice" SortExpression="ContractPrice" /> </Columns> </asp:GridView> <asp:GridView ID="grdContractVariationRoutes" runat="server" AutoGenerateColumns="False" DataKeyNames="ContractVariationRouteID" DataSourceID="ldsContractVariationRoutes" CssClass=gridview> <selectedrowstyle backcolor = "khaki" /> <Columns> <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" /> <asp:BoundField DataField="ContractVariationRouteID" HeaderText="ContractVariationRouteID" InsertVisible="False" ReadOnly="True" SortExpression="ContractVariationRouteID" /> <asp:BoundField DataField="ContractVariationID" HeaderText="ContractVariationID" SortExpression="ContractVariationID" /> <asp:BoundField DataField="ContractRouteID" HeaderText="ContractRouteID" SortExpression="ContractRouteID" /> <asp:BoundField DataField="Route" HeaderText="Route" SortExpression="Route" /> <asp:BoundField DataField="NewContractPrice" HeaderText="NewContractPrice" SortExpression="NewContractPrice" /> <asp:BoundField DataField="ScheduledInServiceMileage" HeaderText="ScheduledInServiceMileage" SortExpression="ScheduledInServiceMileage" /> <asp:BoundField DataField="RouteCategoryID" HeaderText="RouteCategoryID" SortExpression="RouteCategoryID" /> </Columns> </asp:GridView> <asp:LinqDataSource ID="ldsContracts" runat="server" ContextTypeName="DataClassesDataContext" EnableDelete="True" EnableInsert="True" EnableUpdate="True" TableName="Contracts"> </asp:LinqDataSource> <asp:LinqDataSource ID="ldsContractRoutes" runat="server" ContextTypeName="DataClassesDataContext" EnableDelete="True" EnableInsert="True" EnableUpdate="True" TableName="ContractRoutes" Where="Contract == @Contract"> <WhereParameters> <asp:ControlParameter ControlID="drpContracts" Name="Contract" PropertyName="SelectedValue" Type="String" /> </WhereParameters> </asp:LinqDataSource> <asp:LinqDataSource ID="ldsContractVariations" runat="server" ContextTypeName="DataClassesDataContext" EnableDelete="True" EnableInsert="True" EnableUpdate="True" TableName="ContractVariations" Where="Contract == @Contract" OrderBy="Version desc"> <WhereParameters> <asp:ControlParameter ControlID="drpContracts" Name="Contract" PropertyName="SelectedValue" Type="String" /> </WhereParameters> </asp:LinqDataSource> <asp:LinqDataSource ID="ldsContractVariationRoutes" runat="server" ContextTypeName="DataClassesDataContext" EnableDelete="True" EnableInsert="True" EnableUpdate="True" TableName="ContractVariationRoutes" Where="ContractRouteID == @ContractRouteID && ContractVariationID == @ContractVariationID"> <WhereParameters> <asp:ControlParameter ControlID="grdContractRoutes" Name="ContractRouteID" DefaultValue="0" PropertyName="SelectedValue" Type="Int32" /> <asp:ControlParameter ControlID="grdContractVariations" Name="ContractVariationID" DefaultValue="0" PropertyName="SelectedValue" Type="Int32" /> </WhereParameters> </asp:LinqDataSource></
asp:Content>Monday, December 29, 2008 9:37 AM
Answers
-
User-330204900 posted
Have a look at these articles on my blog:
-
Custom PageTemplates Part 1 - Custom PageTemplates with Ajax Control Toolkit Tabs
- Custom PageTemplates Part 2 - A variation of Part 1 with the Details and SubGrid in Tabs
- Custom PageTemplates Part 3 - Dynamic/Templated Grid with Insert (Using ListView)
- Custom PageTemplates Part 4 - Dynamic/Templated FromView
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, December 29, 2008 5:35 PM -
All replies
-
User-330204900 posted
Have a look at these articles on my blog:
-
Custom PageTemplates Part 1 - Custom PageTemplates with Ajax Control Toolkit Tabs
- Custom PageTemplates Part 2 - A variation of Part 1 with the Details and SubGrid in Tabs
- Custom PageTemplates Part 3 - Dynamic/Templated Grid with Insert (Using ListView)
- Custom PageTemplates Part 4 - Dynamic/Templated FromView
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, December 29, 2008 5:35 PM -
-
User-902880243 posted
just the job!
Thanks sjnaughton.
Tuesday, December 30, 2008 2:12 AM