<%@ Control Language="C#" AutoEventWireup="true"
    Inherits="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">
            <RowStyle CssClass="ctrRowStyle" />
            <AlternatingRowStyle CssClass="ctrAltRowStyle" />
            <EditRowStyle CssClass="ctrEditRowStyle" />
            <SelectedRowStyle CssClass="ctrSelRowStyle" />
            <FooterStyle CssClass="ctrFooter" />
            <PagerStyle CssClass="ctrHeaderPager" ForeColor="White" HorizontalAlign="Center" />
            <HeaderStyle CssClass="ctrHeaderPager" ForeColor="White" Font-Bold="True" />
            <EmptyDataRowStyle CssClass="ctrRowStyle" />
            <EmptyDataTemplate>
                <asp:Label runat="server" ID="lblNoRecord" Text='<%# traduci("noRecord") %>' />
            </EmptyDataTemplate>
            <Columns>
                <asp:TemplateField ShowHeader="False">
                    <EditItemTemplate>
                        <asp:ImageButton ID="imgUpdate" runat="server" CausesValidation="False" CommandName="Update"
                            ToolTip='<%# traduci("Update")%>' ImageUrl='<%# imgPath(SteamWare.tipoImg.conferma, SteamWare.dimImg.small) %>' />
                        <asp:ImageButton ID="imgCancel" runat="server" CausesValidation="False" CommandName="Cancel"
                            ToolTip='<%# traduci("Cancel") %>' ImageUrl='<%# imgPath(SteamWare.tipoImg.annulla, SteamWare.dimImg.small) %>' />
                    </EditItemTemplate>
                    <HeaderTemplate>
                        <asp:LinkButton ID="lbtReset" runat="server" OnClick="btnReset_Click" CssClass="btn btn-default btn-sm" Visible="true"><i class="fa fa-refresh"></i> <%: traduci("Reset") %></asp:LinkButton>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:ImageButton ID="imgSelect" runat="server" CausesValidation="False" CommandName="Select"
                            ToolTip='<%# traduci("Select") %>' ImageUrl='<%# imgPath(SteamWare.tipoImg.seleziona, SteamWare.dimImg.small) %>' />
                        <asp:ImageButton ID="imgEdit" runat="server" CausesValidation="False" CommandName="Edit"
                            ToolTip='<%# traduci("Edit") %>' ImageUrl='<%# imgPath(SteamWare.tipoImg.modifica, SteamWare.dimImg.small) %>' />
                    </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='<%# Bind("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='<%# Bind("Lemma") %>' />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Traduzione" SortExpression="Traduzione">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Traduzione") %>' Width="500px"
                            TextMode="MultiLine" Height="8em"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("Traduzione") %>' />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField ShowHeader="False">
                    <EditItemTemplate>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:ImageButton ID="imgDelete" runat="server" CausesValidation="False" CommandName="Delete"
                            ToolTip='<%# traduci("Delete") %>' ImageUrl='<%# imgPath(SteamWare.tipoImg.elimina, SteamWare.dimImg.small) %>' OnClientClick='<%# SteamWare.jsUtils.getCBE("confermaDel") %>' />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
        <asp:Label ID="lblNumRec" runat="server" CssClass="didascalia" />
        <asp:ObjectDataSource ID="ods" runat="server" SelectMethod="getVocabolario" TypeName="GMW_data.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>
