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!

Sunday, 2 June 2013

FIXING THE “HTTP ERROR 401.3 – UNAUTHORIZED” ISSUE IN IIS

I'm trying to test my ASP.Net website on localhost and I'm getting this error:

image


IIS 7 also creates "IUSR" as default user to access files via IIS. So make user IUSR has read access to files/folders.

How to check if IUSR has read Access? Right Click -> Folder -> Properties -> Security Tab See if IUSR is in Group or user names list, If No.

Click Edit -> Add -> Advanced -> Find Now -> Select IUSR and click OK four times

Thursday, 16 May 2013

Download .apk and ipa files from Asp.net website via Email


Here in this article i let you know how to Download .apk and ipa files from Asp.net website (WebApplication) via email.


Step 1: 
In .aspx Add the MailBodyContent below hyperlink. This link located as .apk path

Step 2 :
In web.config add below code with in 


Tuesday, 26 February 2013

User Profile Synchronization Service Stuck at "Starting" - Solution


While configuring User Profile Synchronization in SharePoint 2010, User Profile Synchronization service got stuck at "Starting" state. User profile synchronization service was in starting state for long time! I've been banging my head for couple of Hours.

.
User Profile Synchronization Service Stuck at "Starting" state


After a while, tried running the FIM client from: C:\Program Files\Microsoft Office Servers\14.0\Synchronization Service\UIShell\miisclient.exe , FIM gave an Error Message: Unable to connect to the synchronization Service. found the root cause of the issue! 


FIM Client Error: Unable to connect to the synchronization Service


Solution was: The account I currently logged-in is a Local Administrator account, but not SharePoint Farm Admin! Logged off and logged in with Farm Admin account. Tried stopping the service which was in "Starting" state.

How to stop the User Profile Synchronization service which got stuck at "Starting" state?

In some cases,  user profile synchronization service may started and then stopped. But here, user profile synchronization service hangs! Lets seek help from our friend: PowerShell!  Get the User profile Synchronization service's GUID and pass it to Stop-SPServiceInstace cmdlet.

Get-SPServiceInstance > Services.txt

This will get all the services along with their GUID to a text file, say "services.txt". Open the file and get the GUID of  User profile Synchronization service which will be in Provisioning state.

Once you get the GUID, execute: Stop-SPServiceInstance and provide the GUID

Stop User profile Synchronization service


Restart the Server

worked this time!

In an another case, when we tried re-creating the user profile service application, had the same issue. Fix for this issue was to Remove ForefrontIdentityManager certificates from these 3 locations.
Personal
Trusted Root Certification Authorities
Trusted People
This is because, when I deleted an existing user profile service, it didn't delete the certificates and when recreating it caused the issue!




Wednesday, 30 January 2013

IIS set the Identity in Application pool

when the config the site into iis its also add the system login and password, otherwise its not connect the database server see the below image

Thursday, 24 January 2013

Wednesday, 16 January 2013

ASP.NET Ajax exception – Two components with the same id can’t be added to the application

There’s a couple of exceptions to look out for when you start developing custom ASP.NET Ajax client controls.  They are:

Microsoft JScript runtime error: Sys.InvalidOperationException: Two components with the same id ‘ctl00_MainContentPlaceHolder__eventsRepeater_ctl01_ke1′ can’t be added to the application.
and…
Microsoft JScript runtime error: Sys.InvalidOperationException: A control is already associated with the element.

These errors can be caused when you have a custom control/component which gets added and then re-added at some later point in time – such as when you have a partial page render.  This is being caused because the Sys.Control or Sys.Component gets registered with the Sys.Application when you call the initialize method of your component like so:

MarkItUp.Web.MyCustomControl.callBaseMethod(this, ‘initialize’) ;


Under the hood, the Sys.Application keeps a list of all the components that are registered with it – that’s how $find works.  So when you call ‘initialize’, Sys.Application looks at the list of components that it currently knows about and if yours already exists then you will likely see one of the errors listed above.

The trick is to make sure that you call dispose on your control’s base when you are finished:


dispose : function() { 
    $clearHandlers(this.get_element()) ; 
    // any other cleanup work

    MarkItUp.Web.MyCustomControl.callBaseMethod(this, ‘dispose’) ;
}

Friday, 11 January 2013

ASP.NET Ignores IE7 Compatibility Mode Tag in Web.config

 looks at the <system.web> section of Web.config instead of the <system.webServer> section (which is used by IIS7, unless it's running in compatibility mode). To render this meta tag on every page of your site when running IIS6, I believe the best option is to add it to your MasterPage. I ended up adding the following code block to the OnPreRender event of my MasterPage:



Page.Header.Controls.AddAt(0, new HtmlMeta { HttpEquiv = "X-UA-Compatible", Content = "IE=EmulateIE7" });



The reason I used AddAt instead of just plain Add is because the X-UA-Compatible meta tag apparently has to be the first thing in the page header in order for it to be respected.
Hope this helps someone in the same boat!

Monday, 3 December 2012

Different Colors Using in Sharepoint 2010 Calendar Events



 I have created a team calendar mainly to share meetings, travels and vacations plans. Because I also wanted to manage differently those event types, I have created a Category for each of them.
·         Meeting
·         Holiday
·         Travel
·         Other
Here is my calendar with some information.

Click on the image to zoom

Because I think that color coding would help to easily identify event categories, I have created the following custom view (note that I have chosen not to display start and end time).


Here is the procedure to customize your calendar to be color coded.
Step 1: Create a new column [Color]. This will be used to define the color of the cell based on the category.
On the list settings page, click on Create Colum link. Name the new column “Color”, and set the type of information as Calculated (calculation based on other columns).
The formula is the following:
Finally, set The data type returned from this formula is: to Single line of text. 
=IF([Category]="","LightCyan",
IF([Category]="Meeting","DodgerBlue",
IF([Category]="Holiday","Tomato",
IF([Category]="Travel","LawnGreen",
IF([Category]="Other","DarkBlue","")))))
The result of this column will be a color name based on a category. Note that category should reflect ones you choose and color names can be changed.

Step 2: Create a new column [EventText]. This will contains the html code that will display the event text on the calendar view (including the color scheme).
As above, create a new calculated column with the following formula:

="<span style='position:relative;display:inline-block;width:100%;'>
<span style='width:100%;display:inline-block;text-align:center;border:1px solid "&[Color]&";position:absolute;color:"&[Color]&";'>"&[Title]&"</span>
<span style='display:inline-block;width: 100%;background-color:"&[Color]&";text-align:center;border:1px solid;z-index:-1;filter:alpha(opacity=20);opacity:0.2;'>"&[Title]&"</span></span>"
Note that we used the previously calculated column [Color] to define the cell color, and we also use column [Title] to display the event title inside the cell (you can also display Start Time and End Time if requested).
This is up to you to define your own style, this is simply html syntax.

Step 3: Define [EventText] column as the display on the calendar view.
You now need to create a new view for this calendar. This new view should be a Standard Calendar format view. Define properties as you wish. The important part is to display our newly created column [EventText] to replace the default Title.


Let’s now save the view and check the result.


Not so good isn’t itL. It displays the html code instead of interpreting it. To solve this, we need to insert JavaScript code into the page.
Here is the JavaScript code (such kind of code can be found in MSDN web site or in some blogs like techtrainingnotes.blogspot.com).


// Color coded calendars for SharePoint 2010
<script>

// TechTrainingNotes.blogspot.com
// load our function to the delayed load list
_spBodyOnLoadFunctionNames.push('colorCalendarEventLinkIntercept');
// hook into the existing SharePoint calendar load function
function colorCalendarEventLinkIntercept()
{
  if (SP.UI.ApplicationPages.CalendarNotify.$4a)
  {
    var OldCalendarNotify =
SP.UI.ApplicationPages.CalendarNotify.$4a;
    SP.UI.ApplicationPages.CalendarNotify.$4a = function ()
      {
        OldCalendarNotify();
        colorCalendarEventLinks();
      }
  }
  if (SP.UI.ApplicationPages.CalendarNotify.$4b)
  {
    var OldCalendarNotify =
SP.UI.ApplicationPages.CalendarNotify.$4b;
    SP.UI.ApplicationPages.CalendarNotify.$4b = function ()
      {
        OldCalendarNotify();
        colorCalendarEventLinks();
      }
  }
  // future service pack change may go here!
  // if (SP.UI.ApplicationPages.CalendarNotify.???)
}
// hide the hyperlinks
function colorCalendarEventLinks()
{
// find all DIVs
  var divs = document.getElementsByTagName("DIV");
  for (var i=0;i<divs.length;i++)
  {
    // find calendar item DIVs
    if (divs[i].className.toLowerCase()=="ms-acal-item")
    {
divs[i].innerHTML = divs[i].innerHTML.replace(/&lt;/g,'<').replace(/&gt;/g,'>');
    }
    // find "x more items" links and re-remove links on Expand/Contract
    if (divs[i].className.toLowerCase()=="ms-acal-ctrlitem")
    {
      var links = divs[i].getElementsByTagName("A");
      if (links.length==1)
      {
       links[0].href="javascript:colorCalendarEventLinks();void(0);"
      }
    }
  }
}
</script>
To include the code into the page, there are 2 solutions:On SharePoint Designer, open your SharePoint site. On the left menu, select Lists and Libraries, then click on your Calendar name on the main screen. Right Click on the view you want to color code (or create a new one first) and select Edit File in Advanced Mode.
·         Using SharePoint Designer, the JavaScript code will be added to the page code directly
·         Using Content Editor Web Part, the JavaScript code is embed in a WebPart.

Using SharePoint Designer

Identify the section below to copy your JavaScript code inside

Save and check the result.

You can choose to leave items like this or modify CSS styles to remove the green box around your events.
Search the section <style type="text/css"> and replace with this: 
<style type="text/css">
.ms-acal-time {
  display:none;
}
.ms-acal-selected, .ms-acal-item {
  background:none;border:0px;
}
.ms-acal-sdiv span {
  margin-left:-47px;
}
.ms-acal-sdiv div.ms-acal-title span {
  margin-left:0px;
}
</style>
Save and check the result. Now we have the expected result J.
Using Content Editor Web Part
First of all, the script above should be saved into a txt document and uploaded in one of your site library.

On your custom Calendar View, select Edit page on the Site Actions menu.
Add a Content Editor Web part to Main section; this web part is located under Media and Content category. Edit the web part. Set ContentLink to your script document’s URL andChrome type to None (this will remove web part title and borders)


Save and check the result.
The drawback of this solution is that you will not be able to select other views for this calendar,
where with the SharePoint Designer method, all views are still accessible.

Because of this I prefer to use the using the Contant Editor webpart.
Result was like that.
if we have to remove the time in events mean
using this css
.ms-acal-time {
  display:none;
}
.ms-acal-selected, .ms-acal-item {
  background:none;border:0px;
}
.ms-acal-sdiv span {
  margin-left:-47px;
}
.ms-acal-sdiv div.ms-acal-title span {
  margin-left:0px;
}
After using css result is

Thats it.



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...