<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="ProductCategoryMapping.aspx.vb" Inherits="FinIQWebApp.ProductCategoryMapping" MasterPageFile="~/FiniqAppMasterPage.Master" %>
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TagPrefix="asp" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="Server">


    <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
    </asp:ScriptManagerProxy>
 

    <style type="text/css">

         .Grid {
           table-layout: fixed;
       }

           .Grid th, .Grid td {
               word-wrap: break-word;
           }


        /*.OuterContainer
        {
            width:1880px;
            height:870px;		
        }*/
		/*.TopContainer
        {
            width:1880px;
            height:65px;
            border-color:gray;
			border-style:solid;
			border-width:1px;
			 margin-left:4px;
        }*/
        /*.topTable
        {
            width:100%;
        }*/
      
        
        /*.MiddleContainer
        {
            border-color:gray;
			border-style:solid;
			border-width:1px;
            width:1880px;
            height:790px;
            margin-top:4px;
            margin-left:4px;
          
        }*/
        .CheckboxListCore_Field_VisibilityPanel
        {
            width:150px;
            border-bottom-width: thin;
        }
        .CheckboxListHedging_TypePanel
        {
            width:190px;
            border-bottom-width: thin;
        }
        /*.button {
           Width:120px;
           font: normal 13px verdana !important; 
           height:30px !important;           
           border:solid 1px #CCCCCC !important;
           border-collapse:collapse !important;        
           color:#000000 !important;      
           background-color:#F2F2F3 !important;
           margin-left : 6px;
           margin-top : 6px;
           margin-bottom : 6px;

       }
     
        .Applybutton {
           Width:100px;
           font: normal 13px verdana !important; 
           height:30px !important;           
           border:solid 1px #CCCCCC !important;
           border-collapse:collapse !important;        
           color:black !important;      
           background-color:#F2F2F3 !important;
           margin-left : 6px;
           margin-top : 6px;
           margin-bottom : 6px;
       }*/
        .Enabled-button
        {
            width: 90px;
            /*  margin-left: 5px;*/
        }

        .tablespace
        {
            margin-top: 10px;
        }

        /*.lblDisp
        {
            text-align:left;    
            height:20px;
        }*/
        .panel
        {
            top:250px;
            left:580px;
            position:absolute;          
            display:none;
        }
        .displayNone
        {
            display:none;
        }
        .panelContainer
        {
            background-color:#CCCCCC;
        }
       /*.FixedHeader {
            position: absolute;
           
        }*/   
      /*  .Grid td
        {
            white-space:nowrap;
        }*/
        /*.HighlightRow span
        {
            background-color:lightblue;
        }*/
       
        .divLoading
        {
           position: absolute;
           top: 48px;
           left: 260px;
        }
           /*.Grid th {
           border: solid 1px #dddddd;
           background-color: #ededed !important;
        }*/
        .topTable
        {
            /*margin-left: 10px;
            margin-top: 10px;
            margin-bottom: 20px;*/
        }
        .MiddleContainer {
             margin-left:10px;
        }
         
        /*.Grid td {
            white-space:normal;
        }*/
        .Gridview {
            table-layout:fixed;
            width:100%;
        }
        /*.ctl00_MainContent_gvTemplateMaster a, .Grid a:link {
            color: #3B66D6;
        }*/
           .paddingLarge {
            padding-left:20px;
        }
        .paddingSmall {
            padding-left:10px;
        }
        .width_Name {
            width:95px;
        }
        .width_txtName {
            width:320px;
        }
            .EditColWidthPayoff {
            min-width: 70px !important;
            max-width: 70px !important;
        }
               .EditColWidthDynamicHedgingGroupingKey{
            min-width: 100px !important;
            max-width: 100px !important;
        }

        .DeleteContainer {
            padding: 10px 10px 10px 10px;
            margin-left:574.5px;
            margin-top: 181.5px;
            display: none;
            border-radius: 10px;
            width: 280px;
            height: 100px;
            position: absolute;
            box-shadow: 3px 3px 4px #666;
            border: solid 1px #ddd;
            border-collapse: collapse;
        }
        .paddingRight {
            padding: 1px 15px 1px 1px
        }
    </style>
    <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanelCP"
                               DisplayAfter="0">
        <ProgressTemplate>                  
            <div class="divLoading" >                   
                <img alt="Loading" src="../App_Resources/loading.gif" /><span class="lbl">Loading...&nbsp;&nbsp;</span>
            </div>         
        </ProgressTemplate>
    </asp:UpdateProgress>

    <asp:UpdatePanel ID="UpdatePanelCP" runat="server">
        <ContentTemplate>
         
          <%--  <asp:HiddenField ID="mode" runat="server" value="UPDATE"/>--%>
          
	       
            <table>
              <%--  <tr>
                    

                </tr>--%>
                <tr>

                    <%--<td class="paddingRight">
                        <asp:Label ID="lblEntityId" runat="server" CssClass="lbl" Text="Entity ID : "></asp:Label>
                    </td>
                    <td class="ctlBlotterPaddingRight" >
                        <asp:DropDownList ID="ddlEntityId" runat="server" Width="200px" CssClass="ddl" disabled="true" AutoPostBack="True" AppendDataBoundItems="true">                           
                        </asp:DropDownList>
                     </td>
                    --%>

                   

                     <asp:Button ID="hdn_RowsPerPagebtn" Text="" Style="display: none;" runat="server" />
                    </td>
                <%--</tr>

                <tr>
                    <td style="height: 10px; font-family: Verdana; font-size: 12px;"></td>
                </tr>
            

                <tr>--%>
                    <%--<td class="paddingRight">
                        <asp:Label ID="lblProductCategory" runat="server" CssClass="lbl" Text="Product Category : "></asp:Label>
                    </td>
                    <td class="paddingRight">
                        <asp:DropDownList ID="ddlProductCategory" runat="server" Width="200px" CssClass="ddl" AutoPostBack="True" AppendDataBoundItems="true">
                        </asp:DropDownList>
                    </td>--%>
                    <td class="paddingRight">
                       
                    </td> 
                    <td class="paddingRight">
                       
                    </td>
                    
                  


                     <td class="paddingRight">
                        <asp:Button ID="btnLoad" runat="server" CssClass="btn" Width="90px" Text="Load" />
                    </td>    
                        <%--<asp:Button ID="btnTemplateDelete" runat="server" CssClass="btn" Width="90px" Text="Delete" OnClientClick="return confirm('Do you want to perform this Action ?');" />--%> 
                    <td class="paddingRight">
                        <asp:Button ID="btnDelete" autopostback="False" runat="server" CssClass="btn" Width="90px" Text="Delete" />
                    </td>  
                    <td class="paddingRight">
                        <asp:Button ID="btnAdd" runat="server" CssClass="btn" Width="90px" Text="Add" Enabled="false"/>
                    </td>
                    <td class="paddingRight">
                        <asp:Button ID="btnSave" runat="server" CssClass="btn" Width="90px" Text="Save" Enabled="false" />
                    </td>
                   

                    <td class="paddingRight">             
                        <asp:Label ID="Label1" runat="server"> Row(s) Per Page : </asp:Label>
                    </td>

                    <td class="paddingRight">
                         <asp:TextBox ID="txtRowsPerPage" autopostback="true" CausesValidation="true" runat="server" CssClass="txt" onkeypress="return isNumberKey(event);" onkeydown="return isEnterKey(event);" style="width: 50px"></asp:TextBox>
                    </td>
                    

                    <td class="paddingRight">
                        <asp:Label ID="lblTotal" runat="server" CssClass="lbl">Total Records : 0</asp:Label>
                    </td>
            
                    
                    <td class="paddingRight">
                            <input type="hidden" id="hdnButtonClick" runat="server" />
                    </td>
                    <td class="paddingRight" colspan="4">
                        <asp:Label ID="lblError" runat="server" CssClass="lblError" Width="250px"></asp:Label>
                    </td>
                           

                </tr>

            </table>
	      
           
            <div runat="server" id="MiddleContainer">
                <table class="tablespace">
                    <tr>
                        <td>

                            <asp:GridView ID="gvProductCategoryMaster" runat="server" AllowSorting="True" AutoGenerateColumns="False"
                                BorderStyle="Solid" BorderWidth="1px" CellPadding="1" CssClass="Grid"  AllowPaging="true" ShowHeaderWhenEmpty="true" RowHeadersWidthSizeMode="DisableResizing;">
                                <SelectedRowStyle CssClass="GridItemSelect" />
                                <RowStyle CssClass="GridItem" />
                                <HeaderStyle CssClass="GridHeader" />
                                <FooterStyle CssClass="GridFooter" />
                                <PagerStyle CssClass="GridPager" />
                                <PagerSettings Mode="NumericFirstLast"
                                    FirstPageText="First"
                                    LastPageText="Last"
                                    Position="Bottom" />

                        
                        <EmptyDataTemplate>
                            <asp:Label ID="lblqueuedatagrid" runat="server" Text="No data found." class="lbl"></asp:Label>
                        </EmptyDataTemplate>
                 
                                <Columns>

                                    <asp:TemplateField>
                                        <ItemStyle Width="10px" HorizontalAlign="Center" />
                                        <HeaderStyle Width="10px" />
                                        
                                        <ItemTemplate>
                                            <asp:CheckBox ID="chkRow" runat="server" AutoPostBack="true" ></asp:CheckBox>
                                        </ItemTemplate>
                                    </asp:TemplateField>

                                    <asp:TemplateField HeaderStyle-Wrap="True" Visible="true" HeaderText="Actions">
                                       <ItemStyle HorizontalAlign="center"  Width="100px"/>
                                       <HeaderStyle  Width="100px"/>
                                       <EditItemTemplate>
                                           <asp:LinkButton ID="btnUpdateNew" runat="server" CommandName="Update"  Text="Update" HorizontalAlign="left" CssClass="display: inline-block;" />
                                           &nbsp;
                                           <asp:LinkButton ID="btnCancelNew" runat="server" CommandName="Cancel"  Text="Cancel" HorizontalAlign="right" CssClass="display: inline-block;" />
                                       </EditItemTemplate>
                                       <ItemTemplate>
                                           <asp:LinkButton ID="btnEditNew" HorizontalAlign="center" runat="server" CommandName="Edit" Text="Edit" />
                                       </ItemTemplate>
                                   </asp:TemplateField>

                                    <asp:TemplateField HeaderText="PCM ID" Visible="False">
                                        <HeaderStyle Width="50px" />
                                        <ItemStyle Wrap="true" Width="50px" HorizontalAlign="right" />
                                        <ItemTemplate>
                                            <asp:Label ID="lblPCM_Id"  runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.PCM_Id").ToString)%>' />
                                        </ItemTemplate>
                                        <EditItemTemplate>
                                            <asp:TextBox ID="txtPCM_Id" Enabled="false"   runat="server" Width="50px" CssClass="txt" Style="text-align:right" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.PCM_Id").ToString)%>'></asp:TextBox>
                                        </EditItemTemplate>
                                    </asp:TemplateField>


                                    <asp:TemplateField HeaderText="Entity ID" Visible="false">
                                        <HeaderStyle Width="50px" />
                                        <ItemStyle Wrap="true" Width="50px" HorizontalAlign="right" />
                                        <ItemTemplate>
                                            <asp:Label ID="lblPCM_Entity_Id"  runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.PCM_Entity_Id").ToString)%>' />
                                        </ItemTemplate>
                                        <EditItemTemplate>
                                            <asp:TextBox ID="txtPCM_Entity_Id" AutoPostBack="True"  onkeypress="return isNumberKey(event)" runat="server" Width="50px" CssClass="txt" Style="text-align:right" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.PCM_Entity_Id").ToString)%>'></asp:TextBox>
                                        </EditItemTemplate>
                                    </asp:TemplateField>

                                    <asp:TemplateField HeaderStyle-Wrap="True" HeaderText="Product Category" Visible="true">
                                        <ItemStyle Width="130px" HorizontalAlign="left" />
                                        <HeaderStyle Width="130px" />
                                        <ItemTemplate>
                                            <asp:Label ID="lblProductCategory" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.PCM_ProductCategory").ToString)%>'/>
                                        </ItemTemplate>
                                        <EditItemTemplate>
                                          <asp:DropDownList ID="ddlgrdProductCategory" runat="server" Width="130px" CssClass="ddl" AutoPostBack="True" AppendDataBoundItems="true" >
                                          </asp:DropDownList>

                                        </EditItemTemplate>
                                    </asp:TemplateField>


                                    
                                    

                                    <asp:TemplateField HeaderText="Product">
                                        <HeaderStyle Wrap="False" Width="130px"></HeaderStyle>
                                         <ItemStyle HorizontalAlign="left" Wrap="false  "/>
                                        <ItemTemplate>
                                            <asp:Label ID="lblTemplate" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.PCM_Template_Name").ToString)%>' />
                                        </ItemTemplate>
                                        <EditItemTemplate>
                                             <asp:DropDownList ID="ddlgrdTemplate" runat="server" Width="130px" CssClass="ddl" AutoPostBack="True" AppendDataBoundItems="true" OnSelectedIndexChanged = "fillVariationDropDownForTemplateChange">
                                             </asp:DropDownList>
                                        </EditItemTemplate>
                                    </asp:TemplateField>

                                   <%-- <asp:TemplateField HeaderText="Variation">
                                        <HeaderStyle Wrap="False" Width="180px"></HeaderStyle>
                                         <ItemStyle HorizontalAlign="left" Wrap="false  "/>
                                        <ItemTemplate>
                                            <asp:Label ID="lblVariation" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.PCM_Variation").ToString)%>' />
                                        </ItemTemplate>
                                        <EditItemTemplate>
                                            <asp:TextBox ID="txtVariation" runat="server" Width="180px"   CssClass="txt" Text='<%# (DataBinder.Eval(Container, "DataItem.PCM_Variation").ToString)%>'></asp:TextBox>
                                        </EditItemTemplate>
   
                                    </asp:TemplateField>--%>


                                    <asp:TemplateField HeaderText="Variation">
                                        <HeaderStyle Wrap="False" Width="180px"></HeaderStyle>
                                         <ItemStyle HorizontalAlign="left" Wrap="false  "/>
                                        <ItemTemplate>
                                            <asp:Label ID="lblVariation" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.PCM_Variation").ToString)%>' />
                                        </ItemTemplate>
                                        <EditItemTemplate>
                                            <asp:DropDownList ID="ddlVariation" runat="server" Width="180px"   CssClass="ddl" AutoPostBack="True" AppendDataBoundItems="true"></asp:DropDownList>
                                        </EditItemTemplate>
   
                                    </asp:TemplateField>


                                     <asp:TemplateField HeaderText="Email Subject">
                                        <HeaderStyle Wrap="False" Width="180px"></HeaderStyle>
                                         <ItemStyle HorizontalAlign="left" Wrap="false  "/>
                                        <ItemTemplate>
                                            <asp:Label ID="lblEmailSubject" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.PCM_Email_Subject").ToString)%>' />
                                        </ItemTemplate>
                                        <EditItemTemplate>
                                            <asp:TextBox ID="txtEmailSubject" runat="server" Width="180px"   CssClass="txt" Text='<%# (DataBinder.Eval(Container, "DataItem.PCM_Email_Subject").ToString)%>'></asp:TextBox>
                                        </EditItemTemplate>
   
                                    </asp:TemplateField>


                                    <asp:TemplateField HeaderText="Created By">
                                        <HeaderStyle Wrap="False" Width="100px"></HeaderStyle>
                                         <ItemStyle HorizontalAlign="left" Wrap="false  "/>
                                        <ItemTemplate>
                                            <asp:Label ID="lblPCM_Created_By" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.PCM_Created_By").ToString)%>' />
                                        </ItemTemplate>
                                        
                                    </asp:TemplateField>

                                    <asp:TemplateField HeaderText="Created At">
                                        <HeaderStyle Wrap="False" Width="130px"></HeaderStyle>
                                         <ItemStyle HorizontalAlign="Center" Wrap="false  "/>
                                        <ItemTemplate>
                                            <asp:Label ID="lblPCM_Created_At" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(If(DataBinder.Eval(Container, "DataItem.PCM_Created_At") Is DBNull.Value, "", Convert.ToDateTime(DataBinder.Eval(Container, "DataItem.PCM_Created_At")).ToString("dd-MMM-yyyy HH:mm:ss tt"))).ToString%>' />
                                        </ItemTemplate>
                                      
                                        
                                    </asp:TemplateField>


                                    <asp:TemplateField HeaderText="Updated By">
                                        <HeaderStyle Wrap="False" Width="100px"></HeaderStyle>
                                         <ItemStyle HorizontalAlign="left" Wrap="false  "/>
                                        <ItemTemplate>
                                            <asp:Label ID="lblPCM_Updated_By" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.PCM_Updated_By").ToString)%>' />
                                        </ItemTemplate>
                                        
                                    </asp:TemplateField>

                                    <asp:TemplateField HeaderText="Updated At">
                                        <HeaderStyle Wrap="False" Width="130px"></HeaderStyle>
                                         <ItemStyle HorizontalAlign="Center" Wrap="false  "/>
                                        <ItemTemplate>
                                            <asp:Label ID="lblPCM_Updated_At" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(If(DataBinder.Eval(Container, "DataItem.PCM_Updated_At") Is DBNull.Value, "", Convert.ToDateTime(DataBinder.Eval(Container, "DataItem.PCM_Updated_At")).ToString("dd-MMM-yyyy HH:mm:ss tt"))).ToString%>' />
                                        </ItemTemplate>
   
                                    </asp:TemplateField>

                                   

                                    <asp:TemplateField HeaderText="Misc 1" Visible="False">
                                        <HeaderStyle Wrap="False" Width="100px"></HeaderStyle>
                                         <ItemStyle HorizontalAlign="left" Wrap="false  "/>
                                        <ItemTemplate>
                                            <asp:Label ID="lblPCM_Misc1" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.PCM_Misc1").ToString)%>' />
                                        </ItemTemplate>
                                        <EditItemTemplate>
                                            <asp:TextBox ID="txtPCM_Misc1" runat="server" Width="100px"   CssClass="txt" Text='<%# (DataBinder.Eval(Container, "DataItem.PCM_Misc1").ToString)%>'></asp:TextBox>
                                        </EditItemTemplate>
                                    </asp:TemplateField>

                                    <asp:TemplateField HeaderText="Misc 2" Visible="False">
                                        <HeaderStyle Wrap="False" Width="100px"></HeaderStyle>
                                         <ItemStyle HorizontalAlign="left" Wrap="false  "/>
                                        <ItemTemplate>
                                            <asp:Label ID="lblPCM_Misc2" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.PCM_Misc2").ToString)%>' />
                                        </ItemTemplate>
                                        <EditItemTemplate>
                                            <asp:TextBox ID="txtPCM_Misc2" runat="server" Width="100px"   CssClass="txt" Text='<%# (DataBinder.Eval(Container, "DataItem.PCM_Misc2").ToString)%>'></asp:TextBox>
                                        </EditItemTemplate>
                                    </asp:TemplateField>

                                    <asp:TemplateField HeaderText="Misc 3" Visible="False">
                                        <HeaderStyle Wrap="False" Width="100px"></HeaderStyle>
                                         <ItemStyle HorizontalAlign="left" Wrap="false  "/>
                                        <ItemTemplate>
                                            <asp:Label ID="lblPCM_Misc3" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.PCM_Misc3").ToString)%>' />
                                        </ItemTemplate>
                                        <EditItemTemplate>
                                            <asp:TextBox ID="txtPCM_Misc3" runat="server" Width="100px"   CssClass="txt" Text='<%# (DataBinder.Eval(Container, "DataItem.PCM_Misc3").ToString)%>'></asp:TextBox>
                                        </EditItemTemplate>
                                    </asp:TemplateField>

                                 
                                    </Columns>
                                    
                                   
                                </asp:GridView>
                        </td>
                        
                       
                    </tr>
                       <asp:HiddenField  ID="hdnDeleteRowIndex" runat ="server" />    <%-- Added By RuchiraM on 6-june-2018--%>
                    <asp:Button ID="btnConfirmation" runat="server" Width="0" Style="width: 0px; height: 0px; font-size: 0; border: none; display:none;" />
              
                </table>
            </div>
           
        
        </ContentTemplate>
    </asp:UpdatePanel>
 <script type = "text/javascript">



     function isNumberKey(evt) {
       
         var charCode = (evt.which) ? evt.which : evt.keyCode;
         if ($("[id*='hdnButtonClick']")[0].value == "I" || $("[id*='hdnButtonClick']")[0].value == "E")
             return false;
         if (charCode > 31 && (charCode < 48 || charCode > 57))
             return false;
         
         return true;
         
     }

     function isEnterKey(evt) {

         var charCode = (evt.which) ? evt.which : evt.keyCode;
         if ($("[id*='hdnButtonClick']")[0].value == "I" || $("[id*='hdnButtonClick']")[0].value == "E") {
          
             return false;
         }
         if (charCode == 13) {
             if (parseInt($("[id*='txtRowsPerPage']")[0].value) == 0) {
                 $($(".lblError")[0]).text("Please select valid rows per page value")
             }
             document.getElementById("<%=hdn_RowsPerPagebtn.ClientID%>").click();
         }
         return true;
     }

     var dialogConfirmed = false;
     function ViewDialogDuplicate(obj, title, dialogText) {
         
         if ($("#pageName").html() != null) {
         }
         
         if (!dialogConfirmed) {
             $('html').append(String.Format("<div id='dialog' title='{0}'><p style='float:left;'><span class='ui-icon ui-icon-alert' style='float:left; margin:0 5px 20px 0;'></span>{1}</p></div>", title, dialogText));
             $('#dialog').dialog
                     ({
                         height: 180,
                         width: 350,
                         modal: true,
                         resizable: false,
                         draggable: true,
                         close: function (event, ui) { $('html').find('#dialog').remove(); },
                         buttons:
                         {
                             'Yes': function () {
                                 $("#ctl00_MainContent_btnConfirmation").click();
                                 $(this).dialog('close');
                             },
                             'No': function () {
                                 $(this).dialog('close');
                                 $('html').find("#dialog").remove();
                                 return false;
                             }
                         }
                     });
         }

         return dialogConfirmed;
         $(".ui-widget-overlay").height($("body").height());

     }

    </script>
</asp:Content>