<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_confLinea.ascx.cs" Inherits="GMW.WebUserControls.mod_confLinea" %>

<asp:GridView runat="server" ID="grView" AutoGenerateColumns="False" DataKeyNames="IdxConf" DataSourceID="ods" CssClass="table table-striped table-condensed table-sm table-primary">
  <HeaderStyle CssClass="default" />
  <PagerStyle CssClass="active GridPager" />
  <PagerSettings Mode="NumericFirstLast" />
  <SelectedRowStyle CssClass="table-primary text-light2" />
  <EmptyDataTemplate>
    <asp:LinkButton runat="server" ID="lbtAddNew" CssClass="btn btn-success btn-sm" OnClick="lbtAddNew_Click" ToolTip="Add New Record">Add New <i class="fa fa-plus" aria-hidden="true"></i></asp:LinkButton>
  </EmptyDataTemplate>
  <Columns>
    <asp:TemplateField ShowHeader="False">
      <HeaderTemplate>
        <asp:LinkButton runat="server" ID="lbtAddNew" CssClass="btn btn-success btn-sm" OnClick="lbtAddNew_Click" ToolTip="Add New"><i class="fa fa-plus" aria-hidden="true"></i></asp:LinkButton>
      </HeaderTemplate>
      <EditItemTemplate>
        <div class="text-nowrap">
          <asp:LinkButton ID="lbtUpdate" runat="server" CausesValidation="True" CommandName="Update" CssClass="btn btn-sm btn-success"><i class="fa fa-check" aria-hidden="true"></i></asp:LinkButton>
          &nbsp;<asp:LinkButton ID="lbtCancel" runat="server" CausesValidation="False" CommandName="Cancel" CssClass="btn btn-sm btn-warning"><i class="fa fa-ban" aria-hidden="true"></i></asp:LinkButton>
        </div>
      </EditItemTemplate>
      <ItemTemplate>
        <asp:LinkButton ID="lbtEdit" runat="server" CausesValidation="False" CommandName="Edit" CssClass="btn btn-sm btn-info"><i class="fa fa-edit" aria-hidden="true"></i></asp:LinkButton>
      </ItemTemplate>
    </asp:TemplateField>
    <asp:TemplateField HeaderText="Param" SortExpression="CodParam">
      <EditItemTemplate>
        <asp:DropDownList runat="server" ID="ddlCodParam" SelectedValue='<%# Bind("CodParam") %>'>
          <asp:ListItem Text="Particolare" Value="Particolare" />
        </asp:DropDownList>
      </EditItemTemplate>
      <ItemTemplate>
        <asp:Label ID="Label2" runat="server" Text='<%# Eval("CodParam") %>'></asp:Label>
      </ItemTemplate>
    </asp:TemplateField>
    <asp:BoundField DataField="Valore" HeaderText="Valore" SortExpression="Valore" />
    <asp:TemplateField HeaderText="M" SortExpression="Modo">
      <EditItemTemplate>
        <asp:DropDownList runat="server" ID="ddlModo" SelectedValue='<%# Bind("Modo") %>'>
          <%--<asp:ListItem Text="VETO" Value="0" />--%>
          <asp:ListItem Text="PASSA" Value="1" />
        </asp:DropDownList>
      </EditItemTemplate>
      <ItemTemplate>
        <i runat="server" class='<%# cssFromModo(Eval("Modo")) %>' aria-hidden="true"></i>
      </ItemTemplate>
    </asp:TemplateField>
    <asp:TemplateField ShowHeader="False">
      <EditItemTemplate>
      </EditItemTemplate>
      <ItemTemplate>
        <asp:LinkButton ID="lbtDelete" runat="server" CausesValidation="False" CommandName="Delete" CssClass="btn btn-sm btn-danger" OnClientClick="return confirm('Confermi eliminazione?')"><i class="fa fa-trash" aria-hidden="true"></i></asp:LinkButton>
      </ItemTemplate>
    </asp:TemplateField>
  </Columns>
</asp:GridView>
<asp:ObjectDataSource runat="server" ID="ods" InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" SelectMethod="getByLinea" TypeName="GMW_data.DS_magazzinoTableAdapters.ConfLineaTableAdapter" UpdateMethod="updateQuery" DeleteMethod="deleteQuery" OnDeleted="ods_Deleted" OnUpdated="ods_Updated">
  <DeleteParameters>
    <asp:Parameter Name="Original_IdxConf" Type="Int32" />
  </DeleteParameters>
  <InsertParameters>
    <asp:Parameter Name="CodLinea" Type="String" />
    <asp:Parameter Name="CodParam" Type="String" />
    <asp:Parameter Name="Valore" Type="String" />
    <asp:Parameter Name="Modo" Type="Int32" />
  </InsertParameters>
  <SelectParameters>
    <asp:ControlParameter ControlID="hfCodLinea" DefaultValue="###" Name="codLinea" PropertyName="Value" Type="String" />
  </SelectParameters>
  <UpdateParameters>
    <asp:Parameter Name="CodParam" Type="String" />
    <asp:Parameter Name="Valore" Type="String" />
    <asp:Parameter Name="Modo" Type="Int32" />
    <asp:Parameter Name="Original_IdxConf" Type="Int32" />
  </UpdateParameters>
</asp:ObjectDataSource>
<asp:HiddenField runat="server" ID="hfCodLinea" />
