<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_part2kit.ascx.cs" Inherits="GMW.WebUserControls.mod_part2kit" %>
<%@ Register Src="~/WebUserControls/mod_autocomplete.ascx" TagPrefix="uc1" TagName="mod_autocomplete" %>


<% if (false)
  { %>
<link href="../Content/Style.css" rel="stylesheet" type="text/css" />
<% } %>
                         
<asp:ObjectDataSource ID="odsParticolareAll" runat="server" OldValuesParameterFormatString="Original_{0}" SelectMethod="getAnime" TypeName="GMW_data.DS_ApplicazioneTableAdapters.AnagParticolariTableAdapter">
  <SelectParameters>
    <asp:SessionParameter DefaultValue="MM" Name="CodCS" SessionField="CodCS" Type="String" />
  </SelectParameters>
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="odsParticolare" runat="server" OldValuesParameterFormatString="Original_{0}" SelectMethod="getAnimeNoKit" TypeName="GMW_data.DS_ApplicazioneTableAdapters.AnagParticolariTableAdapter">
  <SelectParameters>
    <asp:SessionParameter DefaultValue="MM" Name="CodCS" SessionField="CodCS" Type="String" />
    <asp:ControlParameter ControlID="hfCodKIT" PropertyName="Value" Name="CodKIT" Type="String" />
  </SelectParameters>
</asp:ObjectDataSource>

<div class="form-group mb-2">
  <label class="col-sm-2 control-label">Particolare aggiunto</label>
  <div class="col-sm-10">
    <asp:DropDownList runat="server" ID="ddlParticolari" DataSourceID="odsParticolare" DataValueField="Particolare" DataTextField="Particolare"></asp:DropDownList>
  </div>
</div>
<asp:GridView ID="grView" runat="server" DataSourceID="ods" DataKeyNames="Particolare" AutoGenerateColumns="False" AllowSorting="True" Width="100%" OnSelectedIndexChanged="grView_SelectedIndexChanged" CssClass="table table-striped table-condensed table-responsive">
  <HeaderStyle CssClass="default" />
  <PagerStyle CssClass="active GridPager" />
  <PagerSettings Mode="NumericFirstLast" />
  <SelectedRowStyle CssClass="info" />
  <EmptyDataTemplate>
    Nessun Record |
        <asp:Button ID="btnNew" runat="server" OnClick="btnNewFromEmpty_Click" Text='<%# traduci("New") %>'
          Visible='<%# isWritable() %>' />
  </EmptyDataTemplate>
  <Columns>
    <asp:TemplateField ShowHeader="False" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="6em">
      <HeaderTemplate>
        <asp:Button ID="Button1" runat="server" OnClick="btnNew_Click" Visible="true" Text='<%# traduci("New") %>' />
      </HeaderTemplate>
      <ItemTemplate>
        <div style="white-space: nowrap;">
          <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="6em"></ItemStyle>
    </asp:TemplateField>
    <asp:TemplateField HeaderText="Particolare" SortExpression="Particolare">
      <EditItemTemplate>
        <asp:DropDownList runat="server" ID="ddlParticolari" DataSourceID="odsParticolareAll" DataValueField="Particolare" DataTextField="Particolare" SelectedValue='<%# Bind("Particolare") %>'></asp:DropDownList>
      </EditItemTemplate>
      <ItemTemplate>
        <asp:Label ID="Label1" runat="server" Text='<%# Eval("Particolare") %>'></asp:Label>
      </ItemTemplate>
    </asp:TemplateField>
    <asp:BoundField DataField="QtaPart" HeaderText="QtaPart" SortExpression="QtaPart" />
    <asp:TemplateField ShowHeader="False" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="2em">
      <HeaderTemplate>
        <asp:Button ID="btnNew" runat="server" Text='<%# traduci("New") %>' OnClick="btnNew_Click" Visible="true" />
      </HeaderTemplate>
      <ItemTemplate>
        <div style="white-space: nowrap;">
          <asp:ImageButton ID="imgDelete" runat="server" CausesValidation="False" CommandName="Delete" ToolTip='<%# traduci("Delete") %>' Visible='<%# Eval("CodKIT").ToString()!="" %>' ImageUrl="~/images/elimina_m.png" OnClientClick='<%# SteamWare.jsUtils.getCBE("confermaDel") %>' />
        </div>
      </ItemTemplate>
      <ItemStyle HorizontalAlign="Center" Width="2em"></ItemStyle>
    </asp:TemplateField>
  </Columns>
</asp:GridView>
<asp:ObjectDataSource ID="ods" runat="server" OldValuesParameterFormatString="Original_{0}" SelectMethod="GetData" TypeName="GMW_data.DS_magazzinoTableAdapters.RelKit2PartTableAdapter" FilterExpression=" CodKIT = '{0}' " UpdateMethod="updateQuery" OnUpdating="ods_Updating" DeleteMethod="deleteQuery" InsertMethod="insertQuery" OnDeleted="ods_Deleted" OnUpdated="ods_Updated">
  <DeleteParameters>
    <asp:ControlParameter ControlID="hfCodKIT" DefaultValue="" Name="Original_CodKIT" PropertyName="Value" Type="String" />
    <asp:Parameter Name="Original_Particolare" Type="String" />
  </DeleteParameters>
  <FilterParameters>
    <asp:ControlParameter ControlID="hfCodKIT" DefaultValue="" Name="CodKIT" PropertyName="Value" Type="String" />
  </FilterParameters>
  <InsertParameters>
    <asp:ControlParameter ControlID="hfCodKIT" DefaultValue="" Name="Original_CodKIT" PropertyName="Value" Type="String" />
    <asp:Parameter Name="Particolare" Type="String" />
    <asp:Parameter Name="QtaPart" Type="Int32" />
  </InsertParameters>
  <UpdateParameters>
    <asp:Parameter Name="Particolare" Type="String" />
    <asp:Parameter Name="QtaPart" Type="Int32" />
    <asp:ControlParameter ControlID="hfCodKIT" DefaultValue="" Name="Original_CodKIT" PropertyName="Value" Type="String" />
    <asp:Parameter Name="Original_Particolare" Type="String" />
  </UpdateParameters>
</asp:ObjectDataSource>
<asp:HiddenField runat="server" ID="hfCodKIT" />
