Popular Posts

Friday, December 27, 2013

Eric Garrison's Personal Blog » Blog Archive » Simple MVC 3 Notifications (with Razor and jQuery)

MVC notification -> similar to mine

Eric Garrison's Personal Blog » Blog Archive » Simple MVC 3 Notifications (with Razor and jQuery): "
     $(document).ready(function () {
          $("#NotificationBox").fadeIn(5000);

          if ($("#NotificationBox").attr('class').split(' ').slice(-1) == "nb-success") {
               $("#NotificationBox").delay(3000).fadeOut(1000);
          }
     });
"

'via Blog this'

Eric Garrison's Personal Blog » Blog Archive » Simple MVC 3 Notifications (with Razor and jQuery)

Very similar to my implementation....

Eric Garrison's Personal Blog » Blog Archive » Simple MVC 3 Notifications (with Razor and jQuery): "
     $(document).ready(function () {
          $("#NotificationBox").fadeIn(5000);

          if ($("#NotificationBox").attr('class').split(' ').slice(-1) == "nb-success") {
               $("#NotificationBox").delay(3000).fadeOut(1000);
          }
     });
"

'via Blog this'

Keep your users informed with ASP.NET MVC | Martijn Boland

Showing popup messages from MVC actions. Nice

Keep your users informed with ASP.NET MVC | Martijn Boland:

'via Blog this'

Monday, December 23, 2013

authentication - Error "Membership.Provider" property must be an instance of "ExtendedMembershipProvider" - Stack Overflow

Upgrading an existing MVC4 web application to SimpleMembershipProvider and I was getting this error:

"Error “Membership.Provider” property must be an instance of “ExtendedMembershipProvider”"

scratching my head for an hour or so finally found that the two "Bloody" dlls "Webmatrix.data" and "Webmatrix.webdata" has to be set to "Copy to local true". and this resolved the problem.

But what kind of message is this Microsoft????


authentication - Error "Membership.Provider" property must be an instance of "ExtendedMembershipProvider" - Stack Overflow: "Error “Membership.Provider” property must be an instance of “ExtendedMembershipProvider”"

'via Blog this'

Thursday, December 19, 2013

Build dependency graph for build

http://www.codeproject.com/Articles/699338/Dynamically-build-a-Build-Dependency-Graph

Tuesday, December 17, 2013

SQL Server Forums - SSMS templates location

SQL server SSMS templates location ->

C:\Documents and Settings\rahman\Application Data\Microsoft\Microsoft SQL Server\100\Tools\Shell\Templates\Sql

SQL Server Forums - SSMS templates location:

'via Blog this'

Wednesday, December 11, 2013

Tuesday, December 10, 2013

Monday, December 9, 2013

Msmq detailed example

http://www.codeproject.com/Articles/520323/A-beginners-guide-to-queuing-with-WCF-and-MSMQ-sho

Sunday, December 8, 2013

Show images using model

Trick to show the image in MVC page. Image that is stored in database table:

The trick is to convert the bytes of image to string using this syntax:

ThumbnailPhotoString = "data:image/png;base64," + Convert.ToBase64String(product.ThumbnailPhoto),


Example:

foreach (var product in productDetail)
            {
                homePageProductDetailsDtos.Add(
                    new HomePageProductDetailsDto()
                    {
                        Name = product.Name,
                        Id = product.Id,
                        ProductDescription = product.Description,
                        ProductNumber = product.ProductNumber,
                        ListPrice = product.ListPrice,
                        SubCategoryId = product.ProductSubcategoryID,
                        LargPhotoString = "data:image/png;base64," + Convert.ToBase64String(product.LargPhoto),
                        ThumbnailPhotoString = "data:image/png;base64," + Convert.ToBase64String(product.ThumbnailPhoto),
                        LargePhotoFileName = product.LargePhotoFileName,
                        ThumbnailPhotoFileName = product.ThumbnailPhotoFileName,
                        ThumbnailUrl =  product.ThumbnailPhotoFileName
                    });
            }

Saturday, December 7, 2013

Autofac issue not resolving dependency

Had a nightmare where Autofac was unable to resolve the controller though my unit tests were all ok. The only thing was when running the MVC application the dependency was not resolved.

        [TestMethod()]
        public void Initialise_CategoryController_Ioc()
        {
            
            IContainer container = AutofacBootstrap.GetContainer();
            CategoryController controller = new CategoryController(container.Resolve<ICategoryBusinessObject>());
 
        }
 
        [TestMethod()]
        public void Initialise_ProductController_Ioc()
        {
 
            IContainer container = AutofacBootstrap.GetContainer();
            ProductController controller = new ProductController(container.Resolve<IProductBusinessObject>());
 
        }
 
        [TestMethod()]
        public void Initialise_SubCategoryController_Ioc()
        {
 
            IContainer container = AutofacBootstrap.GetContainer();
            SubCategoryController controller = new SubCategoryController(container.Resolve<ISubCategoryBusinessObject>());
 
        }

All the above tests were ok and resolving the dependency. Couldn't see what was going wrong. After hours of investigation finally found that there were some warnings that:

The primary reference "Mydll.dll" 
could not be resolved because it has an indirect dependency on the assembly "EntityFramework, Version=6.0.0.0, Culture=neutral, 
PublicKeyToken=b77a5c561934e089" which was built against the ".NETFramework,Version=v4.5" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0". 
KidsWear.DependencyResolver

The solution was:

- Uninstall the entity framework package using Nuget 
- Re-add the package reference using the nuget

The reference was in the composite root (DependencyResolver) project!!



Monday, December 2, 2013

Kendo UI example binding to oData and binding to MVC action

@{
    ViewBag.Title = "Home Page";
}
@section featured {

    <div id="grid">
    </div>

    <div id="grid2">
    </div>


}

<script>

    $(document).ready(function () {
        $("#grid").kendoGrid({
            dataSource: {
                type: "odata",
                transport: {
                    read: "http://demos.kendoui.com/service/Northwind.svc/Customers"
                },
                pageSize: 10
            },
            groupable: true,
            sortable: true,
            pageable: {
                refresh: true,
                pageSizes: true,
                buttonCount: 5
            },
            columns: [{
                field: "ContactName",
                title: "Contact Name",
                width: 140
            }, {
                field: "ContactTitle",
                title: "Contact Title",
                width: 190
            }, {
                field: "CompanyName",
                title: "Company Name"
            }, {
                field: "Country",
                width: 110
            }]
        });
    });

    $(document).ready(function () {
        $("#grid2").kendoGrid({
            dataSource: {
                transport: {
                    read: "Home/Contacts"
                },
                pageSize: 5
            },
            groupable: true,
            sortable: true,
            pageable: {
                refresh: true,
                pageSizes: true,
                buttonCount: 5
            },
            columns: [{
                field: "ContactName",
                title: "Contact Name",
                width: 140
            }, {
                field: "ContactTitle",
                title: "Contact Title",
                width: 190
            }, {
                field: "CompanyName",
                title: "Company Name"
            }, {
                field: "Country",
                width: 110
            }]
        });
    });

</script>

Displaying Database-stored Images in ASP.NET MVC with Data URLs | Brian Sullivan

displaying list of images from database by converting the image to base64 string
nice......

Displaying Database-stored Images in ASP.NET MVC with Data URLs | Brian Sullivan:

'via Blog this'