Sunday, October 29, 2017

Edit mode in grid by angular js

HTML:

  <td>
                            <p data-ng-hide="item.editMode"><a data-ng-click="toggleEdit(item)" href="javascript:;">Edit</a> | <a data-ng-click="deleteitem(item)" href="javascript:;">Delete</a></p>
                            <p data-ng-show="item.editMode"><a data-ng-click="save(item)" href="javascript:;">Save</a> | <a data-ng-click="cancel()" href="javascript:;">Cancel</a></p>

                        </td>



Script:

  $scope.toggleEdit = function () {
        this.item.editMode = !this.item.editMode;

    };

Date picker for selecting month and year


            $("#TRANSMY").datepicker({
                format: "M-yyyy",
                viewMode: "months",
                minViewMode: "months",
                autoclose: true
            });

Monday, October 16, 2017

Preventing multiple clicks on button


script: 
   $('.btnCommand').click(function () {

               // var type = $(this).data('type')
                //$('input[name="command"]').val(type)

                $(this).attr('disabled', 'disabled')

                $('form').trigger('submit')
                //$(this).closest('form').attr('target', '_blank').submit();

            })



html:
 <button type="submit" class="btn btn-primary btn-block btnCommand" data-type="Create">Create</button>

Tuesday, October 10, 2017

Package Manager Console Error (Could not load file or assembly)

Exception calling "LoadFrom" with "1" argument(s): "Could not load file or assembly"

Solution:

I've run into this issue twice now. Both times I've had to uninstall entity framework then re-install it for each project in the solution. One thing that took me a while to figure out the second time I did this is that I had to re-start Visual Studio (2012) after re-installing Entity Framework (or I continued to get the "Could not load file or assembly '[path]\packages\EntityFramework.5 .0.0\tools\EntityFramework.PowerShell.Utility.dll'" error).
To get to the Package Manager Console go to: Tools -> Library Package Manager -> Package Manager Console
In the Package Manager uninstall Entity Framework for each project (I selected each project from the Default Project dropdown at the top of the Package Manager Console):
Uninstall-Package EntityFramework -Force
Then install it for each project:
Install-Package EntityFramework
At this point attempting to run the Enable-Migrations command gave the error still, until I closed and restarted Visual Studio. Then it was successful, as was the Update-Database command (after setting AutomaticMigrationsEnabled to true in the Migrations.Configuration file).

Collected


Sunday, October 8, 2017

jQuery Autocomplete

2 important links for autocomplete:


<link href="~/Content/themes/base/jquery-ui.css" rel="stylesheet" />
<script src="~/Scripts/jquery-ui-1.10.4.min.js"></script>

Saturday, October 7, 2017

Auto focus in razor view

   @Html.TextBoxFor(model => model.EmpName, htmlAttributes: new { id = "EmpName", @class = "form-control",@autofocus="true" })