 <%@ Page Title="" Language="C#" EnableEventValidation="false" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="City.aspx.cs" Inherits="HRMS.City" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
      <div class="main-panel">
        <div class="row">
            <div class="col-md-12">
                <section class="panel">
                    <header class="panel-heading">
                        City Setup
                          <div class="action pull-right">
                                 <asp:Button ID="btnSave" class="btn btn-info" ValidationGroup="save" runat="server" Text="Save" OnClick="btnSave_Click"></asp:Button>
                               <input type="button" value="Add New Record" class="btn btn-info" onclick="clearTextBox()" />
                            </div>
                    </header>

                    <div class="panel-body">
                         <div class="span6">
                                <div id="divmessage" runat="server" visible="false" class="alert alert-info alert-dismissable">
                                    <asp:label text="" ID="lbl_msg" CssClass="msg" runat="server"></asp:label>
                                </div>
                            </div>

                            <div class="span6">
                                <div id="diverrmessage" runat="server" visible="false" class="alert alert-info alert-dismissable">
                                    <asp:label text="" id="lbl_err_msg" CssClass="msg" runat="server"></asp:label>
                                </div>
                            </div>

                         <div class="row">
                            <label class="control-label col-md-2">Country</label>
                            <div class="col-md-3">
                                <asp:DropDownList ID="ddl_country" AutoPostBack="true" runat="server" CssClass="form-control select2" OnSelectedIndexChanged="ddl_country_SelectedIndexChanged"></asp:DropDownList>
                                <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator3" ControlToValidate="ddl_country" ErrorMessage="Country is required. " ValidationGroup="save" setfocusonerror="true"></asp:RequiredFieldValidator>
                            </div>


                              <label class="control-label col-md-2">State</label>
                            <div class="col-md-3">
                                <asp:DropDownList ID="ddl_state" runat="server" CssClass="form-control select2"></asp:DropDownList>
                                <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator4" ControlToValidate="ddl_state" ErrorMessage="State is required. " ValidationGroup="save" setfocusonerror="true"></asp:RequiredFieldValidator>
                            </div>
                        </div>

                        <div class="row"  style="padding-top:05px">
                            <asp:HiddenField ID="hid_city" runat="server" />
                            <label class="control-label col-md-2">Title</label>
                            <div class="col-md-3">
                                <asp:TextBox ID="txt_title" runat="server" CssClass="form-control"></asp:TextBox>
                            </div>

                             <label class="control-label col-md-2">City Name</label>
                            <div class="col-md-3">
                                <asp:TextBox ID="txt_name" runat="server" CssClass="form-control"></asp:TextBox>
                                <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator1" ControlToValidate="txt_name" ErrorMessage="City Name is required. " ValidationGroup="save" setfocusonerror="true"></asp:RequiredFieldValidator>
                            </div>
                        </div>

                        <div class="row" style="padding-top:05px">
                            <label class="control-label col-md-2">Date From</label>
                            <div class="col-md-3">
                                <asp:TextBox ID="txt_frm_date" runat="server" CssClass="form-control datetime"></asp:TextBox>
                                <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator2" ControlToValidate="txt_frm_date" ErrorMessage="Date From is required. " ValidationGroup="save" setfocusonerror="true"></asp:RequiredFieldValidator>
                            </div>

                              <label class="control-label col-md-2">Date To</label>
                            <div class="col-md-3">
                                <asp:TextBox ID="txt_date_to" runat="server" CssClass="form-control datetime"></asp:TextBox>
                            </div>
                        </div>

                        <hr />


                          <asp:GridView ID="grd" runat="server" AutoGenerateColumns="False" 
                      cellpadding="0" border="0" class="display" OnRowCommand="grd_RowCommand">
            <Columns>
                <asp:BoundField HeaderText="ID" DataField="CITY_ID" />
                <asp:BoundField HeaderText="City Name" DataField="CITY_NAME" />
                <asp:BoundField DataField="STATE_ID" ItemStyle-CssClass="hidden" HeaderStyle-CssClass="hidden" />
                <asp:BoundField HeaderText="State Name" DataField="state_name" />
                <asp:BoundField DataField="COUNTRY_ID" ItemStyle-CssClass="hidden" HeaderStyle-CssClass="hidden" />
                <asp:BoundField HeaderText="Country Name" DataField="country_name" />
                <asp:BoundField HeaderText="Date From" DataField="DATE_FROM" />
                <asp:BoundField HeaderText="Date To" DataField="DATE_TO" />
                <asp:BoundField DataField="TITLE" ItemStyle-CssClass="hidden" HeaderStyle-CssClass="hidden" />

                <asp:TemplateField ItemStyle-Width="6%" HeaderText="Action">
                    <ItemTemplate>
                        <%--   <%#Container.DataItemIndex+1 %>
                        <asp:CheckBox ID="chk" runat="server" />--%>
                        <asp:LinkButton ID="lnkEdit" runat="server" CommandName="gEdit"><i class="fa fa-pencil" style="font-size:20px !important"></i></asp:LinkButton>
                        &nbsp<asp:LinkButton ID="lnkDelete" runat="server" CommandName="gDelete" OnClientClick="return confirm('Are you sure to delete?')"><i class="fa fa-trash" style="font-size:20px !important"></i></asp:LinkButton>
                        
                        
                            
                     </ItemTemplate>

<ItemStyle Width="6%"></ItemStyle>
                </asp:TemplateField>
            </Columns>
            <%-- Mandatory--%>
            <RowStyle CssClass="rowStyle"/>
           <%-- Mandatory--%>
            <HeaderStyle CssClass="headerStyle" />
           <%-- optional--%>
           <FooterStyle  CssClass="footerStyle"  />
        </asp:GridView>
            <script src="/ThemeScrips/Datatables/media/js/jquery.js" type="text/javascript"></script>
            <script src="/ThemeScrips/Datatables/media/js/jquery.dataTables.min.js" type="text/javascript"></script>
            <script src="/ThemeScrips/Datatables/media/js/jquery.dataTables.js" type="text/javascript"></script>
            <script src="/ThemeScrips/Datatables/media/js/GridviewFix.js" type="text/javascript"></script>
            <script type="text/javascript">
                //without passing class names.
                $("#ContentPlaceHolder1_grd").GridviewFix().dataTable();
                //Passing class names
            </script>

                    </div>
                </section>
            </div>
        </div>
    </div>
    <script src="../../ThemeScrips/jquery.min.js"></script>
    <link href="../../ThemeScrips/select2.min.css"
        rel="stylesheet" />
    <script src="../../ThemeScrips/select2.min.js"></script>
    <script>
        $('.select2').select2();
    </script>

                   <script type="text/javascript">
                       function clearTextBox() {
                           var elements = document.getElementsByTagName("input");
                           for (var ii = 0; ii < elements.length; ii++) {
                               if (elements[ii].type == "text" || elements[ii].type == "hidden") {
                                   elements[ii].value = "";
                               }
                           }
                       }
            </script>

</asp:Content>
