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

<div class="row" style="font-size: 8pt;">
  <div class="col-sm-12">
    <asp:Button ID="btnNewLemma" runat="server" OnClick="btnNewLemma_Click" CssClass="btn btn-success btn-sm" />
    <asp:TextBox ID="txtNewLemma" runat="server" placeholder="inserire lemma" />
  </div>
  <div class="col-sm-12">
    <asp:GridView ID="grView" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
      DataKeyNames="Lingua,Lemma" DataSourceID="ods" OnDataBound="grView_DataBound"
      OnSelectedIndexChanged="grView_SelectedIndexChanged" OnRowEditing="grView_RowEditing" CssClass="table table-striped table-sm">
      <HeaderStyle CssClass="default" />
      <PagerStyle CssClass="active GridPager" />
      <PagerSettings Mode="NumericFirstLast" />
      <SelectedRowStyle CssClass="table-info" />
      <EmptyDataTemplate>
        <asp:Label runat="server" ID="lblNoRecord" Text='<%# traduci("noRecord") %>' />
      </EmptyDataTemplate>
      <Columns>
        <asp:TemplateField ShowHeader="False">
          <EditItemTemplate>
            <asp:LinkButton runat="server" ID="lbtUpdate" CausesValidation="False" CommandName="Update"
              ToolTip='<%# traduci("Update")%>' CssClass="btn btn-success btn-sm" ><i class="fa fa-check-circle-o" aria-hidden="true"></i></asp:LinkButton>
            <asp:LinkButton runat="server" ID="lbtCancel" CausesValidation="False" CommandName="Cancel"
              ToolTip='<%# traduci("Cancel") %>' CssClass="btn btn-warning btn-sm" ><i class="fa fa-ban" aria-hidden="true"></i></asp:LinkButton>
          </EditItemTemplate>
          <HeaderTemplate>
            <asp:LinkButton ID="lbtReset" runat="server" OnClick="btnReset_Click" CssClass="btn btn-warning btn-sm" Visible="true"><i class="fa fa-refresh"></i> <%: traduci("Reset") %></asp:LinkButton>
          </HeaderTemplate>
          <ItemTemplate>
            <asp:LinkButton runat="server" ID="lbtSelect" CausesValidation="False" CommandName="Select"
              ToolTip='<%# traduci("Select") %>' CssClass="btn btn-sm btn-info"><i class="fa fa-search" aria-hidden="true"></i></asp:LinkButton>
            <asp:LinkButton runat="server" ID="lbtEdit" CausesValidation="False" CommandName="Edit"
              ToolTip='<%# traduci("Edit") %>' CssClass="btn btn-sm btn-primary"><i class="fa fa-pencil" aria-hidden="true"></i></asp:LinkButton> 
          </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Lingua" SortExpression="Lingua">
          <EditItemTemplate>
            <asp:Label ID="TextBox0" runat="server" Text='<%# Eval("Lingua") %>' />
          </EditItemTemplate>
          <ItemTemplate>
            <asp:Label ID="Label1" runat="server" Text='<%# Eval("Lingua") %>' />
          </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Lemma" SortExpression="Lemma">
          <EditItemTemplate>
            <asp:Label ID="TextBox2" runat="server" Text='<%# Eval("Lemma") %>' />
          </EditItemTemplate>
          <ItemTemplate>
            <asp:Label ID="Label3" runat="server" Text='<%# Eval("Lemma") %>' />
          </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Traduzione" SortExpression="Traduzione">
          <EditItemTemplate>
            <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Traduzione") %>' CssClass="form-control form-control-sm"
              TextMode="MultiLine" Height="8em"></asp:TextBox>
          </EditItemTemplate>
          <ItemTemplate>
            <asp:Label ID="Label2" runat="server" Text='<%# Eval("Traduzione") %>' />
          </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField ShowHeader="False">
          <EditItemTemplate>
          </EditItemTemplate>
          <ItemTemplate>
            <asp:LinkButton runat="server" ID="lbtDelete" CausesValidation="False" CommandName="Delete"
              ToolTip='<%# traduci("Delete") %>' OnClientClick='<%# SteamWare.jsUtils.getCBE("confermaDel") %>' CssClass="btn btn-sm btn-danger"><i class="fa fa-trash" aria-hidden="true"></i></asp:LinkButton>
          </ItemTemplate>
        </asp:TemplateField>
      </Columns>
    </asp:GridView>
    <asp:Label ID="lblNumRec" runat="server" CssClass="didascalia" />
    <asp:ObjectDataSource ID="ods" runat="server" SelectMethod="getVocabolario" TypeName="AppData.selDataVoc"
      UpdateMethod="updateLemmaVoc" DeleteMethod="deleteLemmaVoc" OldValuesParameterFormatString="Original_{0}"
      FilterExpression="Traduzione LIKE '%{0}%' OR Lemma LIKE '%{0}%' "
      OnUpdated="ods_Updated">
      <UpdateParameters>
        <asp:Parameter Name="Traduzione" Type="String" />
        <asp:Parameter Name="Original_Lingua" Type="String" />
        <asp:Parameter Name="Original_Lemma" Type="String" />
      </UpdateParameters>
      <FilterParameters>
        <asp:SessionParameter DefaultValue="*" Name="ricerca" SessionField="valoreCercato" />
      </FilterParameters>
      <DeleteParameters>
        <asp:Parameter Name="Original_Lingua" Type="String" />
        <asp:Parameter Name="Original_Lemma" Type="String" />
      </DeleteParameters>
    </asp:ObjectDataSource>
  </div>
</div>
