<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="frm_AgregarHotelesExamen.aspx.vb" Inherits="SGHweb.frm_AgregarHotelesExamen" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <link href="../Styles/Examen.css" rel="stylesheet" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
  <!-- noty -->
  <script type="text/javascript" src="../Scripts/noty/jquery.noty.js"></script>
  <!-- themes -->
  <script type="text/javascript" src="../Scripts/noty/themes/default.js"></script>
  <script type="text/javascript" src="../Scripts/noty/layouts/center.js"></script>
  <link rel="stylesheet" type="text/css" href="../Scripts/noty/buttons.css" />

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> 
        <script type="text/javascript">

            function generate_success(type, texto) {
                var n = noty({
                    text: texto,
                    type: type,
                    dismissQueue: false,
                    layout: 'center',
                    modal: true,
                    theme: 'defaultTheme',
                    buttons: [
                            { addClass: 'btn btn-primary', text: 'Ok', onClick: function ($noty) {
                                $noty.close();
                                Close();
                            }
                            },
                          ]
                });
                console.log(type + ' - ' + n.options.id);
                return n;
            }

            function mostrar_alerta_success(texto) {
                $(document).ready(function () {
                    ///////////////////////
                    // alert             //
                    //  information      //
                    //   error           //
                    //    warning        //
                    //     notification  //
                    ///////////////////////

                    var success = generate_success('notification', texto);

                    setTimeout(function () {
                        $.noty.setText(success.options.id, texto);
                    }, 1000);
                });
            }

            function GetRadWindow() {
                var oWindow = null;
                if (window.radWindow)
                    oWindow = window.radWindow;
                else if (window.frameElement.radWindow)
                    oWindow = window.frameElement.radWindow;
                return oWindow;
            }

            function Close() {
                var oWindow = GetRadWindow();
                oWindow.argument = null;
                oWindow.close();
                return false;
            }

            var selected = {};
            function RadGrid_RowSelected(sender, args) {
                var idHotelCloud = args.getDataKeyValue("idHotelCloud");
                if (!selected[idHotelCloud]) {
                    selected[idHotelCloud] = true;
                }
            }
            function RadGrid_RowDeselected(sender, args) {
                var idHotelCloud = args.getDataKeyValue("idHotelCloud");
                if (selected[idHotelCloud]) {
                    selected[idHotelCloud] = null;
                }
            }
            function RadGrid_RowCreated(sender, args) {
                var idHotelCloud = args.getDataKeyValue("idHotelCloud");
                if (selected[idHotelCloud]) {
                    args.get_gridDataItem().set_selected(true);
                }
            }
            function GridCreated(sender, eventArgs) {
                var masterTable = sender.get_masterTableView(),
              headerCheckBox = $telerik.$(masterTable.HeaderRow).find(":checkbox")[0];

                if (headerCheckBox) {
                    headerCheckBox.checked = masterTable.get_selectedItems().length == masterTable.get_pageSize();
                }


            }
        </script>
 </telerik:RadCodeBlock>
</head>
<body>
    
    <form id="form1" runat="server">
    
    <div>
        
<telerik:RadGrid ID="RadGrid1" runat="server" Culture="es-ES" 
            DataSourceID="SqlDataSource_listadoHoteles" AllowMultiRowSelection="True" 
            Skin="Windows7" CellSpacing="0" GridLines="None">
            <ExportSettings>
                <Pdf PageWidth="" />
            </ExportSettings>
            <ClientSettings>
            <Selecting AllowRowSelect="True" 
                    CellSelectionMode="None" UseClientSelectColumnOnly="True" />
                        <ClientEvents 

                        OnGridCreated="GridCreated" OnRowCreated="RadGrid_RowCreated" 
                        OnRowDeselected="RadGrid_RowDeselected" OnRowSelected="RadGrid_RowSelected" />

                        <Selecting 
                            AllowRowSelect="True" CellSelectionMode="None" 
                            UseClientSelectColumnOnly="True" />

                        <ClientEvents 
                            OnGridCreated="GridCreated" OnRowCreated="RadGrid_RowCreated" 
                            OnRowDeselected="RadGrid_RowDeselected" OnRowSelected="RadGrid_RowSelected" />

                        <Scrolling UseStaticHeaders="True" />
            </ClientSettings>

<MasterTableView AutoGenerateColumns="False" DataKeyNames="idHotelCloud" 
                DataSourceID="SqlDataSource_listadoHoteles">
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>

<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>

<ExpandCollapseColumn Visible="True" 
        FilterControlAltText="Filter ExpandColumn column" Created="True">
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>

    <Columns>
        <telerik:GridClientSelectColumn 
            UniqueName="CheckboxSelectColumn">
        </telerik:GridClientSelectColumn>
        <telerik:GridBoundColumn DataField="idHotelCloud" DataType="System.Int32" 
            FilterControlAltText="Filter idHotelCloud column" HeaderText="idHotelCloud" 
            ReadOnly="True" SortExpression="idHotelCloud" UniqueName="idHotelCloud" 
            Display="False">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="NombreHotelRequest" 
            FilterControlAltText="Filter NombreHotelRequest column" HeaderText="NombreHotelRequest" 
            SortExpression="NombreHotelRequest" UniqueName="NombreHotelRequest" 
            Display="False">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="NombreHotel" 
            FilterControlAltText="Filter NombreHotel column" HeaderText="Hotel" 
            SortExpression="NombreHotel" UniqueName="NombreHotel">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="HotelId" DataType="System.Int32" 
            FilterControlAltText="Filter HotelId column" HeaderText="HotelId" 
            SortExpression="HotelId" UniqueName="HotelId" Display="False">
        </telerik:GridBoundColumn>
    </Columns>

<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</EditFormSettings>

<PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
</MasterTableView>

<PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>

<FilterMenu EnableImageSprites="False"></FilterMenu>
</telerik:RadGrid>
        
        <asp:SqlDataSource ID="SqlDataSource_listadoHoteles" runat="server" 
            ConnectionString="<%$ ConnectionStrings:SHIOL_WEB %>" 
            SelectCommand="SELECT [idHotelCloud], [NombreHotelRequest], [NombreHotel], [HotelId] FROM [Hoteles]">
        </asp:SqlDataSource>
        
        <telerik:RadButton ID="RadButton1" runat="server" Text="Guardar">
        </telerik:RadButton>        

    </div>
    
    <telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
    </telerik:RadScriptManager>
    </form>
    
</body>
</html>