Saturday 20 April 2019

Setting up Basic Express Server

-- npm install express

// include express
const express = require('express');
const app = express();

// serve static files in Public folder
app.use(express.static('public'));

// run he server on port 2222
app.listen(2222, () => console.log('Server running on 2222...'));


Wednesday 17 April 2019

Call JavaScript function after AJAX UpdatePanel Refresh (Partial PostBack) in ASP.Net

<asp:UpdatePanel runat="server">
<ContentTemplate>
Employee :
    <asp:ListBox ID="lstEmployee" runat="server" SelectionMode="Multiple">
        <asp:ListItem Text="Nikunj Satasiya" Value="1" />
        <asp:ListItem Text="Dev Karathiya" Value="2" />
        <asp:ListItem Text="Hiren Dobariya" Value="3" />
        <asp:ListItem Text="Vivek Ghadiya" Value="4" />
        <asp:ListItem Text="Pratik Pansuriya" Value="5" />
    </asp:ListBox>
</ContentTemplate>
</asp:UpdatePanel>


<script type="text/javascript">
    window.onload = function () {
        DrawEmployeeDDL();
    };

    //On UpdatePanel Refresh
    var prm = Sys.WebForms.PageRequestManager.getInstance();
    if (prm != null) {
        prm.add_endRequest(function (sender, e) {
            if (sender._postBackSettings.panelsToUpdate != null) {
                DrawEmployeeDDL();
            }
        });
    };

    function DrawEmployeeDDL() {
        $('[id*=lstEmployee]').multiselect({
            includeSelectAllOption: true
        });
    };
</script>


Monday 8 April 2019

React Apollo Boost & GraphQL Template Installer

{
  "name": "project-name",
  "version": "1.0.0",
  "description": "A starter for React-Apollo-GraphQL projects",
  "main": "server.js",
  "scripts": {
    "server": "nodemon server.js",
    "client": "cd client && npm start",
    "dev":
      "concurrently --names \"server,client\" \"npm run server --silent\" \"npm run client --silent\""
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "apollo-server-express": "^1.3.6",
    "bcrypt": "^2.0.1",
    "body-parser": "^1.18.3",
    "concurrently": "^3.5.1",
    "cors": "^2.8.4",
    "dotenv": "^5.0.1",
    "express": "^4.16.3",
    "graphql": "^0.13.2",
    "graphql-tools": "^3.0.2",
    "jsonwebtoken": "^8.2.1",
    "mongoose": "^5.1.3"
  },
  "devDependencies": {
    "nodemon": "^1.17.5"
  }
}

Thursday 4 April 2019

JQuery Datatable add View Edit Delete Column in ASP.NET

"fnDrawCallback": function () {
    jQuery(element).find('thead tr th:last-child').replaceWith("<th>View / Edit</th>");
    jQuery(element).find('tbody tr').each(function () {
        var courseID = $(this).find('td:first-child').html();

        var links = "<a href='/view?id={{courseID}}'></a>";

$(this).find("td:last-child:not(:first-child)").replaceWith("<td>" + links.replace(/{{courseID}}/g, courseID) + "</td>");
    });
}



CSS to position search and page drop downlist:
.dataTables_filter {
    float: left !important;
    text-align: left !important;
}

.dataTables_length {
    float: right !important;
    text-align: right !important;

}


Wednesday 3 April 2019

Git Credential Manager for Windows Popups


screenshot.jpg

  • Installed Git Credential Manager for Windows
  • Opened the terminal by clicking the Terminal button in SourceTree.
  • Issued the commands below:
    • git config --global credential.helper manager
    • git config --global credential.useHttpPath true

Tuesday 2 April 2019

JQuery Datatable with Update Panel in ASP.NET

</head>
<body>
<form runat="server">
    <asp:ScriptManager runat="server">
    ...
</form>

 <script>

    $(document).ready(function () {
        // bind data table on first page load
        bindDataTable(); 

        // bind data table on every UpdatePanel refresh
        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(bindDataTable); 
    });
 
  function bindDataTable() {
    // Apply DataTable library
    jQuery('.datatable-sortable').hide().each((index, element) => {
            jQuery(element)
                .prepend(jQuery("<thead></thead>")
                    .append(jQuery(element).find("tbody tr:first")))
                .dataTable(
                    {
                        "oLanguage": {
                            "sLengthMenu": "Show _MENU_",
                        },
                        "order": [],
                        "iDisplayLength": 20,
                        "aLengthMenu": [[-1, 10, 20, 30, 50, 100, 200], ["All", 10, 20, 30, 50, 100, 200]],
                        "fnInitComplete": function () {
                            jQuery(element)
                                .show()
                                .addClass("hover")
                                .addClass("compact")
                                .addClass("nowrap");
                        }
                    });
        });
     }
</script>

<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css"/>
<script type="text/javascript" src="//cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>

</body>

Upgrade Windows 11 Home to Windows 11 Pro

Disable internet connection (Wi-Fi, Internet, etc.) Change the product key using the following Generic product key:                     VK7J...