Monday, 25 May 2015

KendoUI Chart using in AngularJS with Dynamic data

Here i'm going to do the KendoUI Chart using AngularJS  and getting dynamic data from angular services.

First need to down-lode the required js files for KendoUI and AngularJS like below image,



And Injected Kendo directive to the AngularJS module



In html page





Above image i added the options is "optTest" - its setting the KendoUI chart in control,
And the data source name is  "dsTest" - its assign data dynamically from services.

In Ctrl Side





















In above image

$scope.tempDSTest[] = before assign the dynamic data we assign the empty dataset , because of some time not populated the chart while dynamic dataset assign.
    $scope.optTest = Its implement the some setting for the kenodui chart , here using i'm using area chart settings.
    $scope.dsTest = its the empty dataset or datasource name.







After that i called the testServices.getTestdata() method, In this method i used the web api url for getting data from server

Based on response i assigned to the data source like $scope.dsTest.data(response.data)

I called setup function at end of the control.

Screen


i hope this helpful , have any new idea or need to change something else  please let me know.

Thanks in Advance :) ;)


Thursday, 23 April 2015

Handled ngGridEventScroll for particular ng-grid among more than ng-grid

I am using the multiple ng-grids in same page like below,

$scope.gridOptionsOne = {
//---------
}

$scope.gridOptionsTwo = {
//-----------
}

but i need to trigger ngGridEventScroll for gridOptionsTwo.

So handled the below condition, it will be working fine

$scope.$on('ngGridEventScroll', function(event) {
   if(event.targetScope == $scope.gridOptionsTwo .$gridScope) {
      //----------------
   }
});

Wednesday, 22 April 2015

UI Bootstrap modal error: [$compile:tpload] failed to load template

When getting the following error ,using UI Bootstrap modal dialog in AngularJS project.

Error like


If you got error like above add this below library

"<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.12.1/ui-bootstrap-tpls.min.js"></script>"


Wednesday, 16 April 2014

Auto save data to the server after a cell value changed - AngularJS and ng-grid

Hi friends,

how get the data or auto save data to the server after a cell value changed in angular js

I have to create a controller as "DonarController" and with in create a ng-grid "GridOptions"
<div data-ng-controller="DonarController">
    <form name="bb-donar-form">
        <div class="col-sm-12">
                <div class="gridStyle" data-ng-grid="GridOptions">
                </div>
            </div>
    </form>
</div>
Then have to create functionality for particular grid

(function () {
    angular.module('BloodBank.Controller')
    .controller('DonarController', ['$scope', function ($scope) {
 //past below code here
    } ]);
})()

below code have to past the above.
This functionality is declare the celledit template as a input box with updateEntity(col,row) function

 var cellEditableTemplate = "<input type=\"number\" style=\"width:56px; text-align: right;\" ng-class=\"'colt' + col.index\" ng-input=\"COL_FIELD\" ng-blur=\"updateEntity(col,row)\" ng-model='row.entity.phno'/>";
        
        $scope.GridOptions = {
            data: 'datas',
            enableCellSelection: true,
            enableRowSelection: false,
            columnDefs: [
                { field: 'username', displayName: 'User Name' },
                { field: 'fullname', displayName: 'Full Name' },
                { field: 'bloodtype', displayName: 'Blood Type' },
                { field: 'gender', displayName: 'Gender' },
                { field: 'location', displayName: 'Location'},
                { field: 'phno', displayName: 'Phone No',                                          enableCellEdit: true,                                                            editableCellTemplate: cellEditableTemplate }
            ]
        };

and also add below function,

$scope.updateEntity = function (column, row) {
            console.log(row.entity);
            console.log(column.field);
            }

below screen i get changed cell value from ng-grid



Wednesday, 2 April 2014

Error : Request header field Content-Type is not allowed by Access-Control-Allow-Headers

I got below error when accessing the web api from angular js



So, i have to add the following line in web config(web api)


hope this helpful..


Wednesday, 26 June 2013

Control 'GridView1' of type 'GridView' must be placed inside a form tag with runat=server.

As I thought, your code behind confirmed it that you indeed are exporting your grid.

The above exception occurs when one tries to export a GridView control to Word, Excel, PDF, CSV or any other formats. Here the .net compiler thinks that the control is not added to the form and is rendered, hence it throws this error even if your GridView control is inside a form with runat = “server”.

You have to tell the compiler that the control is rendered explicitly by overriding the VerifyRenderingInServerForm event.


    public override void VerifyRenderingInServerForm(Control control)
    {
        //
    }

This will confirms that an HtmlForm control is rendered for the specified ASP.NET server control at run time

Tuesday, 11 June 2013

Error – Adding the specified count to the semaphore would cause it to exceed its maximum count

Identifying the ProblemAt first I though this might be due to the syntax of the query I was running. However after starting up Query Profiler I was able to run the query directly in SSMS without any issues. The problem clearly was somewhere in the application and not with the SQL query.
After investigating this, it appears that this error is related to ASP.NET’s ADO.NET connection pool manager. When you put together a connection string in your web.config file, you probably won’t be thinking about connection pooling, but by default this will be enabled. The connection pool manager will attempt to find a free connection, but if none are available it will throw the error we saw.
What is a Semaphore in SQL Server?The first question I asked myself was what a semaphore is since I had not heard this term used before. Well, it seems that the definition of semaphore is just a locking mechanism used by SQL Server behind the scenes to prevent more than one task from accessing a data structure that is currently in use. In particular SQL Server protects user log caches using semaphores.
What is the cause of this problem?So that was pretty interesting information. Basically with the error being returned, it appears that some sort of a lock was being retained and not released when my VB.NET application was communicating with SQL Server. It was definitely not a problem with long running queries or forgetting to clean up the connection object after execution was complete.
I’m still not able to pin down exactly what was causing this error to happen. People online speculate that similar problems appear to be caused by network issues. However, when I encountered the problem there were no noticeable network problems though, so I doubt that the network was causing the problem in my case.
Bottom line is that the semaphore locking issue appears to be  related to ASP.NET’s connection pooling. Resources were being locked in the pool and then were not being released, so I would see the semaphore error when my application was trying to access the application pool and no free resources were available.
Why Are Connection Pools Used By Default?So since ADO.NET connection pools seem to be a possible point of failure, the question remains: why are connection pools enabled by default? The answer is performance.
There is a high performance hit involved with establishing a connection with a database, so ADO.NET tries to increase performance by not destroying connections after a call has happened to a database. Rather, ADO.NET puts the released connection into a pool which it holds for the next time that a request to the database is made. In general this ends up returning database results much faster than if connection pooling is disabled.
Of course we have also seen the down-side to connection pooling, which is the semaphore error where ADO.NET tries to access a connection in the pool, and finds that it can’t.
In the case of my application I decided that the possible performance improvement gained by using connection pooling was outweighed by the possibility of getting ugly connection errors such as the semaphore error, so next I will explain how to ‘fix’ the semaphore error by disabling ADO.NET connection pooling.
Fixing the ProblemThe simplest way to fix the ADO.NET semaphore error is to disable connection pooling in the connection string of your web.config file.
Here is an example of what a default connection string might look like. Although it doesn’t specify a connection pooling option, this is enabled by default:
<add name="testConnection" connectionString="Data Source=MyDBServer;Initial Catalog=MyDatabase;Persist Security Info=True;User ID=testUserId;Password=TestPassword;"
 providerName="System.Data.SqlClient" />
Now to disable pooling and get rid of the error message we were seeing, we simply append the directive Pooling=False to the end of our connection parameters as follows:
<add name="testConnection" connectionString="Data Source=MyDBServer;Initial Catalog=MyDatabase;Persist Security Info=True;User ID=testUserId;Password=TestPassword;Pooling=False;"
 providerName="System.Data.SqlClient" />
Pretty simple, right?
Sometimes finding the reason for a problem is more difficult than fixing the problem. Now that I know what was causing the error I will find it easier to diagnose similar problems in future!

KendoUI Chart using in AngularJS with Dynamic data

Here i'm going to do the KendoUI Chart using AngularJS  and getting dynamic data from angular services. First need to down-lode the r...