<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_anagPartImb.ascx.cs" Inherits="GMW.WebUserControls.mod_anagPartImb" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<% if (false)
    { %>
<link href="../Content/Style.css" rel="stylesheet" type="text/css" />
<% } %>
<asp:GridView ID="grView" runat="server" DataSourceID="ods" DataKeyNames="CodCS,CodStato,Particolare" AutoGenerateColumns="False" AllowSorting="True" Width="100%" OnSelectedIndexChanged="grView_SelectedIndexChanged" CssClass="table table-striped table-condensed table-responsive" AllowPaging="True">
    <HeaderStyle CssClass="default" />
    <PagerStyle CssClass="active GridPager" />
    <PagerSettings Mode="NumericFirstLast" />
    <SelectedRowStyle CssClass="info" />
    <EmptyDataTemplate>
        Nessun Record
    </EmptyDataTemplate>
    <Columns>
        <asp:TemplateField ShowHeader="False" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="54px">
            <HeaderTemplate>
                <asp:Button ID="btnReset" runat="server" Text='<%# traduci("Reset") %>' OnClick="btnReset_Click" Visible="true" />
            </HeaderTemplate>
            <ItemTemplate>
                <div style="white-space: nowrap;">
                    <asp:ImageButton ID="imgSelect" runat="server" CausesValidation="False" CommandName="Select" ToolTip='<%# traduci("Select") %>' ImageUrl="~/images/view_m.png" />
                    <asp:ImageButton ID="imgEdit" runat="server" CausesValidation="False" CommandName="Edit" ToolTip='<%# traduci("Edit") %>' ImageUrl="~/images/edit_m.png" />
                </div>
            </ItemTemplate>
            <EditItemTemplate>
                <asp:ImageButton ID="imgUpdate" runat="server" CausesValidation="False" CommandName="Update" ToolTip='<%# traduci("Update")%>' ImageUrl="~/images/apply_m.png" />
                <asp:ImageButton ID="imgCancel" runat="server" CausesValidation="False" CommandName="Cancel" ToolTip='<%# traduci("Cancel") %>' ImageUrl="~/images/cancel_m.png" />
            </EditItemTemplate>
            <FooterTemplate>
                <asp:ImageButton ID="imgInsert" runat="server" CausesValidation="False" CommandName="Insert" ToolTip='<%# traduci("insert") %>' ImageUrl="~/images/new_m.png" OnClick="lblIns_click" />
                <asp:ImageButton ID="imgCancel" runat="server" CausesValidation="False" CommandName="Cancel" ToolTip='<%# traduci("Cancel") %>' ImageUrl="~/images/cancel_m.png" />
            </FooterTemplate>

            <ItemStyle HorizontalAlign="Center" Width="54px"></ItemStyle>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="CodStato" SortExpression="CodStato">
            <EditItemTemplate>
                <asp:DropDownList runat="server" ID="dlCodStato" DataSourceID="odsCodStato" DataTextField="CodStato" DataValueField="CodStato" SelectedValue='<%# Bind("CodStato") %>'></asp:DropDownList>
            </EditItemTemplate>
            <ItemTemplate>
                <asp:Label ID="lblCodStato" runat="server" Text='<%# Bind("CodStato") %>' />
            </ItemTemplate>
            <FooterTemplate>
                <asp:DropDownList runat="server" ID="dlCodStato" DataSourceID="odsCodStato" DataTextField="CodStato" DataValueField="CodStato" SelectedValue='<%# Bind("CodStato") %>'></asp:DropDownList>
            </FooterTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Particolare" SortExpression="Particolare">
            <EditItemTemplate>
                <!--<asp:DropDownList runat="server" ID="dlParticolare" DataSourceID="odsParticolare" DataTextField="Particolare" DataValueField="Particolare" SelectedValue='<%# Bind("Particolare") %>'></asp:DropDownList>-->
                <asp:TextBox ID="txtParticolare" runat="server" Text='<%# Bind("Particolare") %>' />
                <asp:AutoCompleteExtender ID="aceParticolare" runat="server" TargetControlID="txtParticolare" ServicePath="~/WS/AutoCompletamento.asmx" ServiceMethod="elencoParticolari" MinimumPrefixLength="3" CompletionInterval="20" />
            </EditItemTemplate>
            <ItemTemplate>
                <asp:Label ID="lblParticolare" runat="server" Text='<%# Bind("Particolare") %>' />
            </ItemTemplate>
            <FooterTemplate>
                <!--<asp:DropDownList runat="server" ID="dlParticolare" DataSourceID="odsParticolare" DataTextField="Particolare" DataValueField="Particolare" SelectedValue='<%# Bind("Particolare") %>'></asp:DropDownList>-->
                <asp:TextBox ID="txtParticolare" runat="server" Text='<%# Bind("Particolare") %>' />
                <asp:AutoCompleteExtender ID="aceParticolare" runat="server" TargetControlID="txtParticolare" ServicePath="~/WS/AutoCompletamento.asmx" ServiceMethod="elencoParticolari" MinimumPrefixLength="3" CompletionInterval="20" />
            </FooterTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="CodImballo" SortExpression="CodImballo">
            <EditItemTemplate>
                <asp:TextBox ID="txtCodImballo" runat="server" Text='<%# Bind("CodImballo") %>' />
                <asp:AutoCompleteExtender ID="aceCodImballo" runat="server" TargetControlID="txtCodImballo" ServicePath="~/WS/AutoCompletamento.asmx" ServiceMethod="elencoImballi" MinimumPrefixLength="3" CompletionInterval="20" />
            </EditItemTemplate>
            <ItemTemplate>
                <asp:Label ID="lblCodImballo" runat="server" Text='<%# Bind("CodImballo") %>' />
            </ItemTemplate>
            <FooterTemplate>
                <asp:TextBox ID="txtCodImballo" runat="server" Text='<%# Bind("CodImballo") %>' />
                <asp:AutoCompleteExtender ID="aceCodImballo" runat="server" TargetControlID="txtCodImballo" ServicePath="~/WS/AutoCompletamento.asmx" ServiceMethod="elencoImballi" MinimumPrefixLength="3" CompletionInterval="20" />
            </FooterTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="QtaStd" SortExpression="QtaStd">
            <EditItemTemplate>
                <asp:TextBox ID="txtQtaStd" runat="server" Text='<%# Bind("QtaStd") %>' TextMode="Number" />
            </EditItemTemplate>
            <ItemTemplate>
                <asp:Label ID="lblQtaStd" runat="server" Text='<%# Bind("QtaStd") %>' />
            </ItemTemplate>
            <FooterTemplate>
                <asp:TextBox ID="txtQtaStd" runat="server" Text='<%# Bind("QtaStd") %>' TextMode="Number" />
            </FooterTemplate>
        </asp:TemplateField>
        <asp:TemplateField ShowHeader="False" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="54px">
            <HeaderTemplate>
                <asp:Button ID="btnNew" runat="server" OnClick="btnNew_Click" Visible="true" Text='<%# traduci("New") %>' />
            </HeaderTemplate>
            <EditItemTemplate>
                <asp:ImageButton ID="imgUpdate2" runat="server" CausesValidation="False" CommandName="Update" ImageUrl="~/images/apply_m.png" ToolTip='<%# traduci("Update")%>' />
                <asp:ImageButton ID="imgCancel2" runat="server" CausesValidation="False" CommandName="Cancel" ImageUrl="~/images/cancel_m.png" ToolTip='<%# traduci("Cancel") %>' />
            </EditItemTemplate>
            <FooterTemplate>
                <asp:ImageButton ID="imgInsert2" runat="server" CausesValidation="False" CommandName="Insert" ImageUrl="~/images/new_m.png" OnClick="lblIns_click" ToolTip='<%# traduci("insert") %>' />
                <asp:ImageButton ID="imgCancel2" runat="server" CausesValidation="False" CommandName="Cancel" ImageUrl="~/images/cancel_m.png" ToolTip='<%# traduci("Cancel") %>' />
            </FooterTemplate>
            <ItemTemplate>
                <asp:ImageButton ID="imgDelete" runat="server" CausesValidation="False" CommandName="Delete" ImageUrl="~/images/elimina_m.png" ToolTip='<%# traduci("Delete") %>' OnClientClick='<%# SteamWare.jsUtils.getCBE("confermaDel") %>' />
            </ItemTemplate>

            <ItemStyle HorizontalAlign="Center" Width="54px"></ItemStyle>
        </asp:TemplateField>
    </Columns>
</asp:GridView>
<asp:ObjectDataSource ID="ods" runat="server" OldValuesParameterFormatString="Original_{0}" SelectMethod="GetData" TypeName="GMW_data.DS_ApplicazioneTableAdapters.AnagParticolariImballiTableAdapter" OnInserting="recuperaFooter" FilterExpression=" ( Particolare LIKE '%{0}%' OR CodImballo LIKE '%{0}%' OR CodStato LIKE '%{0}%' ) " DeleteMethod="DeleteQuery" InsertMethod="Insert" UpdateMethod="UpdateQuery">
    <DeleteParameters>
        <asp:SessionParameter Name="Original_CodCS" Type="String" SessionField="CodCS" DefaultValue="MM" />
        <asp:Parameter Name="Original_CodStato" Type="String" />
        <asp:Parameter Name="Original_Particolare" Type="String" />
    </DeleteParameters>
    <FilterParameters>
        <asp:SessionParameter DefaultValue="*" Name="ricerca" SessionField="valoreCercato" />
    </FilterParameters>
    <InsertParameters>
        <asp:SessionParameter Name="CodCS" Type="String" SessionField="CodCS" DefaultValue="MM" />
        <asp:Parameter Name="CodStato" Type="String" />
        <asp:Parameter Name="Particolare" Type="String" />
        <asp:Parameter Name="CodImballo" Type="String" />
        <asp:Parameter Name="QtaStd" Type="Int32" />
    </InsertParameters>
    <UpdateParameters>
        <asp:Parameter Name="CodStato" Type="String" />
        <asp:Parameter Name="Particolare" Type="String" />
        <asp:Parameter Name="CodImballo" Type="String" />
        <asp:Parameter Name="QtaStd" Type="Decimal" />
        <asp:SessionParameter Name="Original_CodCS" Type="String" SessionField="CodCS" DefaultValue="MM" />
        <asp:Parameter Name="Original_CodStato" Type="String" />
        <asp:Parameter Name="Original_Particolare" Type="String" />
    </UpdateParameters>
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="odsCodStato" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="GMW_data.DS_UtilityTableAdapters.v_selStatiProdTableAdapter">
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="odsParticolare" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="getByCodCS" TypeName="GMW_data.DS_ApplicazioneTableAdapters.AnagParticolariTableAdapter">
    <SelectParameters>
        <asp:SessionParameter DefaultValue="MM" Name="CodCS" SessionField="CodCS" Type="String" />
    </SelectParameters>
</asp:ObjectDataSource>
