<%@ Page Title="" EnableEventValidation="false" Language="C#" MasterPageFile="~/masContabilidad.master" AutoEventWireup="true" CodeFile="List_TipoPersona.aspx.cs" Inherits="List_TipoPersona" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>


<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<asp:Content ID="Content3" runat="server"  contentplaceholderid="ContentPlaceHolder2">
                 Listado Tipo Persona
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

            <script type="text/javascript">

                function requestStart(sender, args) {
                    if (args.get_eventTarget().indexOf("ExcelExport") != -1)
                        args.set_enableAjax(false);
                    if (args.get_eventTarget().indexOf("PDFExport") > 0)
                        args.set_enableAjax(false);
                    if (args.get_eventTarget().indexOf("WordExport") > 0)
                        args.set_enableAjax(false);
                    if (args.get_eventTarget().indexOf("CSVExport") > 0)
                        args.set_enableAjax(false);
                    if (args.get_eventTarget().indexOf("Print") > 0)
                        args.set_enableAjax(false);
                }

                function ShowEditForm(id, rowIndex) {
                    var grid = $find("<%= tk_Grid.ClientID %>");

                    var rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element();
                    grid.get_masterTableView().selectItem(rowControl, true);

                    window.radopen("InstUpd_TipoPersona.aspx?TipoPersonaID=" + id, "UserListDialog");
                    return false;
                }
                function ShowInsertForm() {
                    window.radopen("InstUpd_TipoPersona.aspx", "UserListDialog");
                    return false;
                }

                function refreshGrid(arg) {
                    if (!arg) {
                        $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");
                    }
                    else {
                        $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("RebindAndNavigate");
                    }
                }
                function RowDblClick(sender, eventArgs) {
                    window.radopen("InstUpd_TipoPersona.aspx?TipoPersonaID=" + eventArgs.getDataKeyValue("TipoPersonaID"), "UserListDialog");
                }
            </script>
            
        </telerik:RadCodeBlock>
        
      <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest" ClientEvents-OnRequestStart="requestStart">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="tk_Grid"  LoadingPanelID="RadAjaxLoadingPanel1"  />
                </UpdatedControls>
            </telerik:AjaxSetting>
        
        
            <telerik:AjaxSetting AjaxControlID="tk_Grid">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="tk_Grid"  LoadingPanelID="RadAjaxLoadingPanel1"  />
                </UpdatedControls>
            </telerik:AjaxSetting>
            
            <telerik:AjaxSetting AjaxControlID="ddlEstado">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="tk_Grid"  LoadingPanelID="RadAjaxLoadingPanel1"  />
                </UpdatedControls>
            </telerik:AjaxSetting>
            
        </AjaxSettings>
    </telerik:RadAjaxManager>

    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Telerik" />      
    

    <table id="Table3" cellspacing="0" cellpadding="0" width="97%" border="0">
       
        <tr>
            <td colspan="3" align="center" style="padding-top:10px">
               
                         <table id="Table4" align="center" border="0" cellpadding="2" cellspacing="0" style="width: 100%;margin-bottom:5px">
                            <tr>
                                <td style="border-top:1px solid #3C7FB1; border-bottom:1px solid #3C7FB1; text-align:right; height:30px; padding-right:6px" class="arial10bold">
                                    &nbsp;Estado : &nbsp;
                                   <telerik:RadComboBox Width="168px" ID="ddlEstado" runat="server" 
                                    AutoPostBack="True"  onselectedindexchanged="ddlEstado_SelectedIndexChanged" 
                                    Skin="Outlook">
                                     
                                    </telerik:RadComboBox>
                                </td>
                            </tr>
                        </table>

                        <table border="0" style="border: #CCCCCC 1px solid; width: 100%">
                            <tr>
                                <td style="text-align: center; height: 21px; padding: 4px;">
                                 <telerik:RadGrid 
                                            AutoGenerateColumns="False" 
                                            ID="tk_Grid" 
                                            
                                            AllowFilteringByColumn="True"

                                            AllowPaging="True" 
                                            PageSize="40" 
                                            AllowSorting="True" 
                                            runat="server" 
                                            GridLines="None" 
                                            Skin="Office2007"
                                            onitemcommand="tk_Grid_ItemCommand" style="margin-top: 0px" 
                                            onneeddatasource="tk_Grid_NeedDataSource"
                                            onitemcreated="tk_Grid_ItemCreated" Height="550px">
                                            <PagerStyle PageButtonCount="10" />
                                            
                                            <AlternatingItemStyle HorizontalAlign="Left"  />
                                            <FilterItemStyle HorizontalAlign="Left" />
                                            
                                            <ClientSettings EnableRowHoverStyle="true">
                                                <Scrolling AllowScroll="true" UseStaticHeaders="true" />
                                                <Selecting AllowRowSelect="true" />
                                            </ClientSettings>
                                            <GroupingSettings CaseSensitive="false" />
                                        <ExportSettings  ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true" >
                                            <Pdf PageWidth="480mm" Creator="SGH-Peru" Author="Sistema de Contabilidad" PageBottomMargin="5px" PageTopMargin="5px" PageLeftMargin="5px" PageRightMargin="5px" />
                                        </ExportSettings>
                                                                                   
                                        <MasterTableView DataKeyNames="TipoPersonaID" CellSpacing="0" CommandItemDisplay="Top">
                                        <Columns>
                                            
                                                <telerik:GridBoundColumn DataField="TipoPersonaID" HeaderText="TipoPersonaID" UniqueName="TipoPersonaID"
                                                    ReadOnly="True" AutoPostBackOnFilter="false" AllowFiltering="false" Visible="false">
                                                </telerik:GridBoundColumn>
                                                
                                                <telerik:GridBoundColumn HeaderText="Nombre" DataField="NombreTipoPersona"
                                                    UniqueName="NombreTipoPersona" SortExpression="NombreTipoPersona" HeaderStyle-Width="180px"
                                                    FilterControlWidth="140px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains"
                                                    ShowFilterIcon="false">
                                                    <HeaderStyle HorizontalAlign="Left" />
                                                    <ItemStyle HorizontalAlign="Left" />
                                                </telerik:GridBoundColumn>
                                                                                               
                                                 <telerik:GridTemplateColumn HeaderStyle-Width="5%" ShowFilterIcon="false" AutoPostBackOnFilter="false"
                                                    AllowFiltering="false" HeaderText="Estado">
                                                    <ItemTemplate>
                                                        <%# f_NombreEstado(Convert.ToInt32(Eval("Estado")))%>
                                                    </ItemTemplate>
                                                    <ItemStyle HorizontalAlign="Right" />
                                                    <HeaderStyle HorizontalAlign="Right" />
                                                </telerik:GridTemplateColumn>

                                                <telerik:GridTemplateColumn HeaderStyle-Width="3%" AllowFiltering="false" >

<HeaderStyle Width="3%"></HeaderStyle>

                                                <ItemStyle HorizontalAlign="Right" />
                                                     <ItemTemplate>
                                                        <asp:HyperLink ID="EditLink" runat="server" ToolTip="Editar" ImageUrl="~/images/botones/editar.png"></asp:HyperLink>
                                                     </ItemTemplate>                                                     
                                                </telerik:GridTemplateColumn>
                                                
                                                <telerik:GridTemplateColumn HeaderStyle-Width="3%" AllowFiltering="false" >

<HeaderStyle Width="3%"></HeaderStyle>

                                                <ItemStyle HorizontalAlign="Right" />
                                                     <ItemTemplate>
                                                        <asp:ImageButton Text="Activar" ToolTip="Activar" CausesValidation="false" CommandArgument='<%# Eval("TipoPersonaID") %>' CommandName="activar" ID="activar" ImageUrl="~/images/botones/activar.png" runat="server" />
                                                     </ItemTemplate>                                                     
                                                </telerik:GridTemplateColumn>

                                                <telerik:GridTemplateColumn HeaderStyle-Width="3%" AllowFiltering="false" >

<HeaderStyle Width="3%"></HeaderStyle>

                                                <ItemStyle HorizontalAlign="Right" />
                                                     <ItemTemplate>
                                                        <asp:ImageButton Text="Desactivar" ToolTip="Desactivar" CausesValidation="false"  CommandArgument='<%# Eval("TipoPersonaID") %>' CommandName="desactivar" ID="desactivar" ImageUrl="~/images/botones/desactivar.png" runat="server" />
                                                     </ItemTemplate>                                                     
                                                </telerik:GridTemplateColumn>
                                                
                                            </Columns>
                                            <CommandItemStyle HorizontalAlign="Left" />
                                            <CommandItemTemplate>
                                                <a href="#" onclick="return ShowInsertForm();" class="botones" title="Agregar Nuevo Registro">Nuevo Registro</a>
                                                <div style="float: right;">
                                                    <asp:ImageButton runat="server" ID="ExcelExport" ImageUrl="~/images/page_excel.png" CommandName="ExportExcel" AlternateText="Excel" ToolTip="Excel" CausesValidation="false" /> 
                                                    <asp:ImageButton runat="server" ID="PDFExport" ImageUrl="~/images/page_acrobat.png" CommandName="ExportPDF" AlternateText="Pdf" ToolTip="Pdf" />
                                                    <asp:ImageButton runat="server" ID="WordExport" ImageUrl="~/images/page_word.png" CommandName="ExportWord" AlternateText="Word" ToolTip="Word" />
                                                    <asp:ImageButton runat="server" ID="CSVExport" ImageUrl="~/images/page_csv.png" CommandName="ExportCSV" AlternateText="CSV" ToolTip="CSV" />
                                                    <asp:ImageButton runat="server" ID="Print" ImageUrl="~/images/printer.png" CommandName="Print" AlternateText="Print" ToolTip="Imprimir" />
                                                </div>
                                            </CommandItemTemplate>
                                           
                                        </MasterTableView>
                                       
                                    </telerik:RadGrid>
                                    
                                </td>
                                
                            </tr>
                        </table>
                        
                        
            </td>
        </tr>
    </table>
     
             <telerik:RadWindowManager ID="RadWindowManager1" runat="server" Skin="Office2007">
            <Windows>
                <telerik:RadWindow ID="UserListDialog" runat="server"  Behaviors="Move,Close"
                  VisibleStatusbar="false" Title="Tipo Persona" AutoSize="false" Width="632px" Height="270px"
                  ReloadOnShow="true" ShowContentDuringLoad="true" Modal="true" />
            </Windows>
            </telerik:RadWindowManager>
     
     
</asp:Content>

