Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Two DetailsView, one Control Parameter for the other ...

Options
  • 14-08-2012 8:23pm
    #1
    Closed Accounts Posts: 3,912 ✭✭✭


    Hi Folks,

    I've run into a cul de sac with this one, I've basically got a GridView on my aspx page and two DetailsView (GridView1, DetailsView1 and DetailsView2), and I'm also using a Masterpage and have placeholders set up...

    GridView1 is a control parameter for DetailsView1 (this functionality is working absolutely fine). Recently I wanted to change the page a bit, so I have set up a few Edit templates in my Details1View, for the purposes of inserting a DropDownList into the DetailsView, (which is bound back to a database table I use for my products), and I want to make this DropDownList, a control parameter for my other DetailsView2, (this DetailsView displays my actual product info...

    However, no matter how many "$" I use and try to point to the control, I'm getting the error "Cannot find Control Parameter X in Parameter Y", where X and Y are what I've typed in for my Control Name and PropertyName...

    Here's my code below (I've put in a DropDown list OUTSIDE of my DetailsView1, to test what I'm trying to do, but once i try to use the DropDownList in my DetailsView1 template (with the ID: EditClutchKitProductID), I'm getting the error above:
    <%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/SiteTransactionDataView.Master" Inherits="ShoppingCart.Web.EditClutchKitCatalog" Codebehind="EditClutchKitCatalog.aspx.cs" %>
    <%-- Add content controls 
    here --%>
    <%@ Import Namespace="ShoppingCart.Common.Entities"%>
    <%@ Import Namespace="System.Globalization"%>
    
    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    
    <script type="text/javascript" src="js/prototype.js"></script>
    <script type="text/javascript" src="js/scriptaculous.js?load=effects"></script>
    <script type="text/javascript" src="js/lightbox.js"></script>
     
    <div id="rnd_containerZZZ">
    <b class="rnd_topZZZ"><b class="rnd_b1ZZZ"></b><b class="rnd_b2ZZZ"></b>
    <b class="rnd_b3ZZZ"></b><b class="rnd_b4ZZZ"></b></b>
    <div class="rnd_contentZZZ"> 
    <div class="box">
        <div class="p4">
         <b>
        Your shopping cart below has <asp:Label ID="_CartSize" runat="server"></asp:Label> items in it costing: &#8364;<asp:Label ID="_FullPrice" runat="server"></asp:Label><asp:Label ID="FullStop" runat="server" Text="."></asp:Label><br />
        </b>   
        </div>
        <div id="DropDownMenu" style="position:absolute; left:10px; top:40px;">       
            <table>
                <tr>
                    
                    <td>
                        <asp:DropDownList ID="_Category" runat="server" Height="20px" Width="400px" 
                            AutoPostBack="True">
                        </asp:DropDownList>
                    
                    </td>
                </tr>
                <tr>
                    
                    <td>
                        <asp:DropDownList ID="_SubCategory" runat="server" Width="400px" 
                            AutoPostBack="True">
                        </asp:DropDownList>
                    </td>
                </tr>
             
            </table>
            <br />
            <table>
       
                <tr>
                    <td>
         
        <asp:Repeater ID="_Catalog" runat="server">
        <HeaderTemplate>
        
        </HeaderTemplate>
    
        <FooterTemplate>
        </FooterTemplate>
        </asp:Repeater>
       
        <asp:Repeater ID="_Cart" runat="server">
        </asp:Repeater>
        
                    </td>
                </tr>
            </table>
           </div>
        
            <asp:SqlDataSource ID="SqlDataSourceA" runat="server" 
            ConnectionString="<%$ ConnectionStrings:xxxxxxxxxxConnectionString %>" 
            SelectCommand="SELECT * FROM [Spec] WHERE  ([SubCatGroup] = @UserID) ORDER BY [ID] ASC" 
            OldValuesParameterFormatString="original_{0}" 
            onselecting="SqlDataSourceA_Selecting" UpdateCommand="UPDATE [Spec] SET [Name] = @Name, [SubCatID] = @SubCatID WHERE [ID] = @original_ID">
            <SelectParameters>
            <asp:Parameter Name="UserID" Type="String" />
            </SelectParameters>
            <UpdateParameters>
            <asp:Parameter Name="Name" Type="String" />
            </UpdateParameters>
            </asp:SqlDataSource>
            
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:xxxxxxxxxxConnectionString %>" 
            DeleteCommand="DELETE FROM [ClutchKitProduct] WHERE [Id] = @Id" 
            InsertCommand="INSERT INTO [ClutchKitProduct] ([Name], [Description], [EngineSpec], [TechInfo], [StockCode], [Quantity], [PurchasePrice], [RetailPriceMultiplier], [RecommendedRetailPrice], [DiscountRate], [DiscountAmount], [Cost], [TransactionProfit], [ProfitMargin], [InputVATRate],[InputVATAmount], [OutputVATRate], [OutputVATAmount], [VATDue], [InvoiceAmountDue]) VALUES (@Name, @Description, @EngineSpec, @TechInfo, @StockCode, @Quantity, @PurchasePrice, @RetailPriceMultiplier, @RecommendedRetailPrice, @DiscountRate, @DiscountAmount, @Cost, @TransactionProfit, @ProfitMargin, @InputVATRate, @InputVATAmount, @OutputVATRate, OutputVATAmount, @VATDue, @InvoiceAmountDue)" 
            SelectCommand="SELECT * FROM [ClutchKitProduct]" 
            UpdateCommand="UPDATE [ClutchKitProduct] SET [Name] = @Name, [Description] = @Description, [TechInfo] = @TechInfo, [StockCode] = @StockCode, [Quantity] = @Quantity, [PurchasePrice] = @PurchasePrice, [RetailPriceMultiplier] = @RetailPriceMultiplier, [RecommendedRetailPrice] = @RecommendedRetailPrice, [DiscountRate] = @DiscountRate, [DiscountAmount] = @DiscountAmount, [Cost] = @Cost, [TransactionProfit] = @TransactionProfit, [ProfitMargin] = @ProfitMargin, [InputVATRate] = @InputVATRate, [InputVATAmount] = @InputVATAmount, [OutputVATRate] = @OutputVATRate, [OutputVATAmount] = @OutputVATAmount, [VATDue] = @VATDue, [InvoiceAmountDue] = @InvoiceAmountDue, [Information] = @Information WHERE [Id] = @Id">
            <DeleteParameters>
            <asp:Parameter Name="Id" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="Name" Type="String" />
                <asp:Parameter Name="Description" Type="String" />
                <asp:Parameter Name="EngineSpec" Type="String" />
                <asp:Parameter Name="TechInfo" Type="String" />
                <asp:Parameter Name="StockCode" Type="String" />
                <asp:Parameter Name="Quantity" Type="Int32" />
                <asp:Parameter Name="PurchasePrice" Type="Decimal" />
                <asp:Parameter Name="RetailPriceMultiplier" Type="Decimal" />
                <asp:Parameter Name="RecommendedRetailPrice" Type="Decimal" />
                <asp:Parameter Name="DiscountRate" Type="Decimal" />
                <asp:Parameter Name="DiscountAmount" Type="Decimal" />
                <asp:Parameter Name="Cost" Type="Decimal" />
                <asp:Parameter Name="TransactionProfit" Type="Decimal" />
                <asp:Parameter Name="ProfitMargin" Type="Decimal" />
                <asp:Parameter Name="InputVATRate" Type="Decimal" />
                <asp:Parameter Name="InputVATAmount" Type="Decimal" />
                <asp:Parameter Name="OutputVATRate" Type="Decimal" />
                <asp:Parameter Name="OutputVATAmount" Type="Decimal" />
                <asp:Parameter Name="VATDue" Type="Decimal" />
                <asp:Parameter Name="InvoiceAmountDue" Type="Decimal" />
                <asp:Parameter Name="Information" Type="string" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="Name" Type="String" />
                <asp:Parameter Name="Description" Type="String" />
                <asp:Parameter Name="EngineSpec" Type="String" />
                <asp:Parameter Name="TechInfo" Type="String" />
                <asp:Parameter Name="StockCode" Type="String" />
                <asp:Parameter Name="Quantity" Type="Int32" />
                <asp:Parameter Name="PurchasePrice" Type="Decimal" />
                <asp:Parameter Name="RetailPriceMultiplier" Type="Decimal" />
                <asp:Parameter Name="RecommendedRetailPrice" Type="Decimal" />
                <asp:Parameter Name="DiscountRate" Type="Decimal" />
                <asp:Parameter Name="DiscountAmount" Type="Decimal" />
                <asp:Parameter Name="Cost" Type="Decimal" />
                <asp:Parameter Name="TransactionProfit" Type="Decimal" />
                <asp:Parameter Name="ProfitMargin" Type="Decimal" />
                <asp:Parameter Name="InputVATRate" Type="Decimal" />
                <asp:Parameter Name="InputVATAmount" Type="Decimal" />
                <asp:Parameter Name="OutputVATRate" Type="Decimal" />
                <asp:Parameter Name="OutputVATAmount" Type="Decimal" />
                <asp:Parameter Name="VATDue" Type="Decimal" />
                <asp:Parameter Name="InvoiceAmountDue" Type="Decimal" />
                <asp:Parameter Name="Information" Type="string" />
                <asp:Parameter Name="Id" Type="Int32" />
            </UpdateParameters>
        </asp:SqlDataSource>
    
     
        <asp:LoginView ID="LoginView1" runat="server">
        <AnonymousTemplate>
        You need to <asp:HyperLink ID="LoginLink" NavigateUrl="~/Admin/Default.aspx" Text="Login" ForeColor="OrangeRed" Font-Bold="true" runat="server"></asp:HyperLink> to view your previous transactions.
        </AnonymousTemplate>
        <LoggedInTemplate>
         Welcome, <asp:LoginName ID="LoginName1" runat="server" ForeColor="OrangeRed" Font-Bold="true" /> 
            <asp:LoginStatus ID="LoginStatus1"  runat="server" ForeColor="OrangeRed" Font-Bold="true" />
     <br /><br />  
        </LoggedInTemplate>
        
        </asp:LoginView>
     
     <div id="MyGrid" runat="server" style="position:absolute; top:130px;" >
            <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False" GridLines="None" BorderStyle="Dashed" BorderColor="Silver" BorderWidth="1"
            DataKeyNames="ID" DataSourceID="SqlDataSourceA" OnRowDataBound="GridView1_RowDataBound" 
            Width="420px" style="margin-right: 0px" 
                OnSelectedIndexChanged="GridView1_SelectedIndexChanged" AutoGenerateEditButton="true" PageSize="18" >
               
                <RowStyle  HorizontalAlign="Center" VerticalAlign="Middle" BorderStyle="Dashed" BorderColor="Gray" BorderWidth="1"  
                    Font-Size="Small" Font-Strikeout="False" Height="24px" />
               
                <Columns>
                
                    <asp:TemplateField HeaderText="ID" SortExpression="SubCatID">
                    <ItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Select" Text='<%# Bind("SubCatID", "{0}") %>' CommandArgument='<%# Bind("SubCatID") %>'>
                    </asp:LinkButton>
                    </ItemTemplate>
                     <EditItemTemplate>
                     <asp:Textbox ID="TextboxSubCat" Columns="1" runat="server" Text='<%# Bind("SubCatID") %>'></asp:Textbox>
                     </EditItemTemplate>
                    </asp:TemplateField>
                                
                     <asp:TemplateField HeaderText="Vehicle Specification" SortExpression="Id">
                     <EditItemTemplate>
                            <asp:Textbox ID="Textbox1" Columns="40" runat="server" Text='<%# Bind("Name") %>'></asp:Textbox>
                            </EditItemTemplate>
    
                            <ItemTemplate>
                            <asp:Label ID="Label14" runat="server" Text='<%# Bind("Name") %>'></asp:Label>
                        </ItemTemplate>
                            </asp:TemplateField>
                            
                            </Columns>
    <SelectedRowStyle BackColor="Lime" Width="0px" />
                <HeaderStyle BackColor="#FF3300" HorizontalAlign="Center" Height="16px" />
                <EditRowStyle BackColor="Red" />
                <AlternatingRowStyle BackColor="#CCCCCC" BorderStyle="Dashed" 
                    BorderWidth="1px" />
            </asp:GridView>
    </div>
    
    </div>
    </div>
    <b class="rnd_bottomZZZ"><b class="rnd_b4ZZZ"></b><b class="rnd_b3ZZZ"></b>
    <b class="rnd_b2ZZZ"></b><b class="rnd_b1ZZZ"></b></b>
    </div>
    
    
    </asp:Content>
    <asp:Content id="ContentZ" ContentPlaceHolderID="ContentPlaceHolderRight" runat="server">
        <div id="Containery">
    <b class="rnd_topy"><b class="rnd_b1y"></b><b class="rnd_b2y"></b>
    <b class="rnd_b3y"></b><b class="rnd_b4y"></b></b>
    <div class="rnd_contenty"> 
    <div class="box">
        
            <asp:SqlDataSource ID="SqlDataSource4" runat="server" 
            ConnectionString="<%$ ConnectionStrings:xxxxxxxxxxConnectionString %>" 
            SelectCommand="SELECT DISTINCT [StoreID] FROM [ClutchKitSpecProduct] WHERE ([StoreID] = @ID)">
            <SelectParameters>
            <asp:ControlParameter ControlID="ContentPlaceholder2$GridView1" Name="ID" PropertyName="SelectedValue" Type="Int32" />
            </SelectParameters>
            </asp:SqlDataSource>
    
            <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:xxxxxxxxxxConnectionString %>" 
            SelectCommand="SELECT * FROM [ClutchKitSpecProduct] WHERE ([StoreID] = @ID)"
            UpdateCommand="UPDATE [ClutchKitSpecProduct] SET [ProductID] = @ProductID, [SpecID] = @SpecID WHERE [Id] = @Id">
            <SelectParameters>
            <asp:ControlParameter ControlID="ContentPlaceholder2$GridView1" Name="ID" PropertyName="SelectedValue" Type="Int32" />
            </SelectParameters>
            <UpdateParameters>
            <asp:ControlParameter ControlID="ContentPlaceholderRight$DetailsView1$DropDownListSpecID" Name="SpecID" PropertyName="SelectedValue" Type="Int32" />
            <asp:ControlParameter ControlID="ContentPlaceholderRight$DetailsView1$EditClutchKitProductID" Name="ProductID" PropertyName="SelectedValue" Type="Int32" />
            </UpdateParameters>
            </asp:SqlDataSource>
    
            <asp:SqlDataSource ID="SqlDataSource11" runat="server" ConnectionString="<%$ ConnectionStrings:xxxxxxxxxxConnectionString %>" 
            SelectCommand="SELECT * FROM [ClutchKitProduct] WHERE ([ID] = @ID)" OldValuesParameterFormatString="original_{0}" 
            onselecting="SqlDataSource3_Selecting">
            <SelectParameters>
            <asp:ControlParameter ControlID="ContentPlaceholderRight$DetailsView2" Name="EditClutchKitStockCode" PropertyName="SelectedValue" Type="String" />
            </SelectParameters>
            </asp:SqlDataSource>
    
            <asp:SqlDataSource ID="SqlDataSource10" runat="server" ConnectionString="<%$ ConnectionStrings:xxxxxxxxxxConnectionString %>" SelectCommand="SELECT * FROM [ClutchKitProduct]"></asp:SqlDataSource>
            
    [COLOR="Blue"]<asp:DropDownList ID="DropDownTestList" AutoPostBack="true" runat="server" DataSourceID="SqlDataSource10" DataTextField="StockCode" DataValueField="ID"></asp:DropDownList>[/COLOR]
    
    [COLOR="Blue"]//This is a temporary Test DropDownList that I have set up to check if what I'm try to do, will work, (to control my DetailsView2) and it is working grand[/COLOR]
            
            <asp:DetailsView ID="DetailsView1" runat="server" BorderStyle="Dashed"  AutoGenerateRows="False" AllowPaging="true" DataKeyNames="ID" DataSourceID="SqlDataSource2" Height="50px" Width="540px" GridLines="None" OnDataBound="DetailsView1_Databound" AutoGenerateEditButton="true" EditRowStyle-Width="100">
            <RowStyle Font-Size="Small" BorderStyle="Dashed" BorderWidth="1" BorderColor="#333333" />
            <Fields>
                    <asp:BoundField DataField="ID" HeaderText="ID:" ItemStyle-BorderStyle="Dashed" ItemStyle-BorderColor="#333333" ItemStyle-BorderWidth="1px" SortExpression="ID" />
                    <asp:BoundField DataField="ProductID" HeaderText="ProductID:" ItemStyle-BorderStyle="Dashed" ItemStyle-BorderColor="#333333" ItemStyle-BorderWidth="1px" SortExpression="ProductID" />
                    
                    <asp:TemplateField HeaderText="Product ID:" SortExpression="ProductID">
                    <EditItemTemplate>
                    [COLOR="Red"]<asp:DropDownList ID="EditClutchKitProductID" runat="server" DataSourceID="SqlDataSource10" DataTextField="StockCode"  SelectedValue='<%# Bind("ProductID") %>' DataValueField="ID" OnSelectedIndexChanged="EditClutchKitStockCode_OnSelectedIndexChanged"></asp:DropDownList>[/COLOR]
    
    [COLOR="Red"]//This is the DropDownList that is causing the error...[/COLOR]
                    </EditItemTemplate>
                    <InsertItemTemplate>
                    <asp:Label ID="ProductIDInsertLabel" runat="server" Text='<%# Bind("ProductID") %>'></asp:Label>
                    </InsertItemTemplate>
                    <ItemTemplate>
                    <asp:DropDownList ID="ItemClutchKitProductID" runat="server" DataSourceID="SqlDataSource10" AutoPostBack="true" SelectedValue='<%# Bind("ProductID") %>' OnDataBound="ItemClutchKitProductID_OnDataBound" DataTextField="StockCode" DataValueField="ID"></asp:DropDownList>
                    </ItemTemplate>
                    </asp:TemplateField>
            
                    <asp:BoundField DataField="StoreID" HeaderText="Store ID:" ItemStyle-BorderStyle="Dashed" ItemStyle-BorderColor="#333333" ItemStyle-BorderWidth="1px" SortExpression="StoreID" />
                    
                    <asp:TemplateField HeaderText="Spec ID:" SortExpression="SpecID">
                    <EditItemTemplate>
                    <asp:DropDownList ID="DropDownListSpecID" runat="server" DataSourceID="SqlDataSource4" DataTextField="StoreID" AutoPostBack="false" DataValueField="StoreID" AppendDataBoundItems="true" SelectedValue='<%# Bind("StoreID") %>'>
                    <asp:ListItem Enabled="true" Value="3585" Text="Hide"></asp:ListItem>
                    </asp:DropDownList>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                    <asp:Label ID="SpecIDInsertLabel" runat="server" Text='<%# Bind("SpecID") %>'></asp:Label>
                    </InsertItemTemplate>
                    <ItemTemplate>
                    <asp:Label ID="SpecIDItemLabel" runat="server" Text='<%# Bind("SpecID") %>'></asp:Label>
                    </ItemTemplate>
                    </asp:TemplateField>
            </Fields>
            </asp:DetailsView>
            <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:xxxxxxxxxxConnectionString %>" 
            SelectCommand="SELECT * FROM [ClutchKitProduct] WHERE ([ID] = @ProductID)" OldValuesParameterFormatString="original_{0}">
            <SelectParameters>
           <asp:ControlParameter ControlID="DropDownTestList" Name="ProductID" PropertyName="SelectedValue" Type="Int32" />
            </SelectParameters>
            </asp:SqlDataSource>
            <br />
        
            <asp:DetailsView ID="DetailsView2" runat="server" GridLines="None" AutoGenerateRows="False" AllowPaging="true" FieldHeaderStyle-Width="20%" 
            DataKeyNames="ID" DataSourceID="SqlDataSource3" Height="50px" Width="540px" BorderStyle="Dashed" AutoGenerateEditButton="true" >
            <RowStyle Font-Size="Small" ForeColor="#CCCCCC" BorderStyle="Dashed" BorderWidth="1" BorderColor="#333333" />
            <Fields>
    
                    <asp:TemplateField HeaderText="SID:" ItemStyle-BorderStyle="Dashed" ItemStyle-BorderColor="#333333" ItemStyle-BorderWidth="1px" SortExpression="StockCode">
                    <EditItemTemplate>
                    <asp:DropDownList ID="EditClutchKitStockCode" runat="server" SelectedValue='<%# Bind("StockCode") %>' DataSourceID="SqlDataSource10" DataTextField="StockCode" DataValueField="StockCode" OnSelectedIndexChanged="EditClutchKitStockCode_OnSelectedIndexChanged"></asp:DropDownList><asp:Button ID="Update" runat="server" Text="Update" />
                    </EditItemTemplate>
                    <InsertItemTemplate>
                    <asp:Label ID="StockCodeInsertLabel" runat="server" Text='<%# Bind("StockCode") %>'></asp:Label>
                    </InsertItemTemplate>
                    <ItemTemplate>
                    <asp:Label ID="StockCodeItemLabel" runat="server" Text='<%# Bind("StockCode") %>'></asp:Label>
                    </ItemTemplate>
                    </asp:TemplateField>
    
                    <asp:BoundField DataField="Id" HeaderText="Id" InsertVisible="False" ReadOnly="True" SortExpression="Product" />
                    <asp:BoundField DataField="Name" HeaderText="Product: " InsertVisible="False" ReadOnly="True" SortExpression="Id" />
                    <asp:BoundField DataField="Description" HeaderText="Items: " InsertVisible="False" ReadOnly="True" SortExpression="Description" />
                    <asp:BoundField DataField="EngineSpec" HeaderText="Eng: " InsertVisible="False" ReadOnly="True" SortExpression="EngineSpec" />
                    <asp:BoundField DataField="TechInfo" HeaderText="Tech: " InsertVisible="False" ReadOnly="True" SortExpression="TechInfo" />
                    <asp:BoundField DataField="Quantity" HeaderText="In Stock: " InsertVisible="False" ReadOnly="True" SortExpression="Quantity" />              
                    <asp:BoundField DataField="PurchasePrice" HeaderText="Cost: " InsertVisible="False" ReadOnly="True" SortExpression="PurchasePrice" />
                    <asp:BoundField DataField="RetailPriceMultiplier" HeaderText="Mark-Up: " InsertVisible="False" ReadOnly="True" SortExpression="RetailPriceMultiplier" />
                    <asp:BoundField DataField="RecommendedRetailPrice" HeaderText="RRP: " InsertVisible="False" ReadOnly="True" SortExpression="RecommendedRetailPrice" />
                    <asp:BoundField DataField="DiscountRate" HeaderText="Discount: " InsertVisible="False" ReadOnly="True" SortExpression="DiscountRate" />
                    <asp:BoundField DataField="DiscountAmount" HeaderText="Discount Amt: " InsertVisible="False" ReadOnly="True" SortExpression="DiscountAmt" />
                    <asp:BoundField DataField="Cost" HeaderText="Trade " InsertVisible="False" ReadOnly="True" SortExpression="Cost" />
                    <asp:BoundField DataField="TransactionProfit" HeaderText="Profit: " InsertVisible="False" ReadOnly="True" ControlStyle-ForeColor="OrangeRed" SortExpression="TransactionProfit" />
                    <asp:BoundField DataField="ProfitMargin" HeaderText="Margin: " InsertVisible="False" ReadOnly="True" ControlStyle-ForeColor="OrangeRed" SortExpression="ProfitMargin" />
                    <asp:BoundField DataField="InputVATRate" HeaderText="Input VAT: " InsertVisible="False" ReadOnly="True" SortExpression="InputVATRate" />
                    <asp:BoundField DataField="InputVATAmount" HeaderText="Input VAT(&#8364;): " InsertVisible="False" ReadOnly="True" SortExpression="InputVATAmount" />
                    <asp:BoundField DataField="OutputVATRate" HeaderText="Output VAT: " InsertVisible="False" ReadOnly="True" SortExpression="OutputVATRate" />
                    <asp:BoundField DataField="OutputVATAmount" HeaderText="Output VAT(&#8364;): " InsertVisible="False" ReadOnly="True" SortExpression="OutputVATAmount" />                
                    <asp:BoundField DataField="VATDue" HeaderText="VAT Due: " InsertVisible="False" ReadOnly="True" SortExpression="VATDue" />
                    <asp:BoundField DataField="InvoiceAmountDue" HeaderText="Amt Due: " InsertVisible="False" ReadOnly="True" SortExpression="InvoiceAmountDue" />
    
                    <asp:BoundField DataField="Information" HeaderText="Info: " InsertVisible="False" ReadOnly="True" SortExpression="Information" />
    
                    </Fields>
    
        </asp:DetailsView>
    
      </div>
     
    </div>
    <b class="rnd_bottomy"><b class="rnd_b4y"></b><b class="rnd_b3y"></b>
    <b class="rnd_b2y"></b><b class="rnd_b1y"></b></b>
    </div>
    </asp:Content>
    

    I've tried using this line of code as my Control Paramter, (which works fine as an update parameter for my DetailsView1, but is causing an error for my DetailsView2?!?!?

    [PHP]

    <SelectParameters>

    <asp:ControlParameter ControlID="ContentPlaceholderRight$DetailsView1$EditClutchKitProductID" Name="ProductID" PropertyName="SelectedValue" Type="Int32" />

    </SelectParameters>


    [/PHP]

    This control parameter is working fine for updating my DetailsView1 Table, I can't understand how the same code, when used as a Control Parameter for DetailsView2, is causing an error?????? :confused::confused::confused:

    Any help with this, as always, is hugely appreciated, I've spent the last few days prícking around with this trying to fix it but no luck, am at a compete dead end with it!


Comments

  • Registered Users Posts: 11,979 ✭✭✭✭Giblet


    You seem to be using the dynamically generated IDs?


  • Closed Accounts Posts: 3,912 ✭✭✭HellFireClub


    Giblet wrote: »
    You seem to be using the dynamically generated IDs?

    No, when I wrote the code for the page initially, I initially couldn't get it to work, and when I did a bit of Googling on the error, it turned out that apparently where you are using a Masterpage, you have to reference the control absolutely, so I had to use:

    [PHP]
    <SelectParameters>
    <asp:ControlParameter ControlID="ContentPlaceholder2$GridView1" Name="ID" PropertyName="SelectedValue" Type="Int32" />

    </SelectParameters>
    [/PHP]

    And this got it to work where it was running into an error previously (cannot find control parameter "x" in parameter "y"...

    Now, even though I am using:

    [PHP]
    <SelectParameters>
    <asp:ControlParameter ControlID="ContentPlaceholderRight$DetailsView1$DropDownListProductID" Name="SpecID" PropertyName="SelectedValue" Type="Int32" />


    </SelectParameters>
    [/PHP]

    I'm getting this same error....


  • Closed Accounts Posts: 3,912 ✭✭✭HellFireClub


    I'd have thought this would have been as simple as just referencing the control, while taking account of the fact that it's in a PlaceHolder and a DetailsView?

    So, what would be:
    <asp:ControlParameter ControlID="DropDownListProductID" Name="SpecID" PropertyName="SelectedValue" Type="Int32" />
    

    Outside my DetailsView, (which works just as I want it to, except that it isn't in my DetailsView!), would become:
    [COLOR=#000000][COLOR=#007700]<[/COLOR][COLOR=#0000BB]asp[/COLOR][COLOR=#007700]:[/COLOR][COLOR=#0000BB]ControlParameter ControlID[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#DD0000]"ContentPlaceholderRight[/COLOR][COLOR=#0000BB]$DetailsView1$DropDownListProductID[/COLOR][COLOR=#DD0000]" [/COLOR][COLOR=#0000BB]Name[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#DD0000]"SpecID" [/COLOR][COLOR=#0000BB]PropertyName[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#DD0000]"SelectedValue" [/COLOR][COLOR=#0000BB]Type[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#DD0000]"Int32" [/COLOR][COLOR=#007700]/>
    [/COLOR][/COLOR]
    


  • Closed Accounts Posts: 3,912 ✭✭✭HellFireClub


    Thanks to Giblet for looking at this, for any other misfortunate who runs into the same headache, I'm posted the solution below that I've got to work for me, where SQLDataSource3 is the Datasource ID for the second DetailsView...
            protected void SqlDataSource3_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
            {
     
    
                    if (DetailsView1.CurrentMode == DetailsViewMode.ReadOnly)
                    {
                        Label ItemProductLabel = this.DetailsView1.FindControl("ItemClutchKitProductID") as Label;
    
                        if (ItemProductLabel != null)
                        {
                            e.Command.Parameters["@ProductID"].Value = Int32.Parse(ItemProductLabel.Text);
                        }
    
                    }
    
                    if (DetailsView1.CurrentMode == DetailsViewMode.Edit)
                    {
                        DropDownList EditProductDDL = this.DetailsView1.FindControl("EditClutchKitProductID") as DropDownList;
    
                        if (EditProductDDL != null)
                        {
                            e.Command.Parameters["@ProductID"].Value = Int32.Parse(EditProductDDL.SelectedValue);
                        }
                    }
    

    aspx page:

    [PHP] <asp:SqlDataSource ID="SqlDataSource3" runat="server" OnSelecting="SqlDataSource3_Selecting" ConnectionString="<%$ ConnectionStrings:repcoConnectionString %>" SelectCommand="SELECT * FROM [ClutchKitProduct] WHERE [ID] = @ProductID&quot;>
    <SelectParameters>
    <asp:Parameter Name="ProductId" Type="String" />
    </SelectParameters>
    </asp:SqlDataSource>[/PHP]


Advertisement