Skip to main content

Posts

Showing posts from December, 2015

$parse, $broadcast, $emit and $on in AngularJs

  The AngularJs provide services for event based communication between the controllers. i.e.           1.    $ parse ,           2.     $ on ,           3.      $ emit  and           4.       $ broadcast The $scope.$on() is how we listen for these events. The $scope.$emit() will fire an event up the $scope. The $scope.$broadcast() will fire an event down the $scope. //THE BROADCAST EVENT FIRING AN EVENT DOWNWARDS $scope.$broadcast( 'yourEvent' , {     yourBroadcast: 'broadcast whatever you want.' // send whatever you want }); //THE BROADCAST EVENT LISTEN FOR THE EVENT IN THE RELEVANT $SCOPE $scope.$on( 'yourEvent' , function (e, data) {     alert(JSON.stringify(data)); }); // THE BROADCAST EVENT FIRING AN EVENT UPWARDS $scope.$emit( 'yourEvent' , 'Your custom message' );

There was a problem sending the command to the program excel

AngularJs Conditional CSS Class and CSS Style

Hello everyone, I am going to share the code sample for apply the css class and css style in AngularJs with and without conditions. The example as given below in details. Use of  CSS Class in AngularJs <div ng-repeat = "user in users" ng-class = "{class-active': user.isActive}" >   <label ng-show = "!(user.isDeleted)" >     <input type = "checkbox" ng-model = "user.isActive" />     <span> {{user.UserName}} </span>   </label> </div Use of  CSS style in AngularJs <div ng-repeat = "user in users" ng-style = "{color: myColor}" >   <label ng-show = "!(user.isDeleted)" >   </label> </div OR <div ng-repeat = "user in users" ng-style = "{width: user.isValid == 'Invalid'  ?  0% : 100%}" >   <label ng-show = "!(user.isDeleted)" >   </label>

like operator in sql server

ALTER PROCEDURE [dbo] . [sp_GetCustomer] --'343'             -- Add the parameters for the stored procedure here     @CustomerID NVARCHAR ( 50 ) AS BEGIN             -- SET NOCOUNT ON added to prevent extra result sets from             -- interfering with SELECT statements.             SET NOCOUNT ON ;     -- Insert statements for procedure here             SELECT   CUST . CustomerID ,                                     CUST . CustomerName                                                FROM [DBO] . [CUSTOMER] as CUST WHERE CUST . CustomerID LIKE '%' + @CustomerID + '%'   END

Google Leans on Microsoft for Angular 2 Launch

Google Leans on Microsoft for Angular 2 Launch Interesting news for  AngularJs developers, Please go below link for Google Leans on Angular 2 Launch. http://www.eweek.com/developer/google-leans-on-microsoft-for-angular-2-launch-2.html Regards, Anil

email regular expression in javascript

//email regular expression in javascript // Validate email address inJavaScript? var   emailValidation = function (emailText) {     var regular = "\w+([-+.']\w+)* @ \w+([-.]\w+)*\.\w+([-.]\w+)*" ;     return regular.test(emailText); }

Create and insert into temp table in sql server

// CREATEAND INSERT INTO TEMP TABLE IN SQL SERVER DECLARE @S VARCHAR ( 8000 ), @Split CHAR ( 1 ), @leng BIGINT ,                   @percoll VARCHAR ( 8000 ), @cnt BIGINT          SET @Str = '4,5,6,7'              SET @Split = ',' SET @leng = ( SELECT COUNT (*) FROM dbo . SplitString ( @Str , @Split )) DECLARE @temp TABLE (   ID BIGINT IDENTITY ( 1 , 1 ), RoleID BIGINT , count INT ) INSERT INTO @temp                 SELECT * FROM (                                 SELECT RoleID , COUNT (*) AS [Count] FROM [dbo] . [TBL_Role] GROUP BY RoleID                                 ) AS INNERTABLE                 WHERE [count] = @leng SET @cnt = ( SELECT COUNT (*) FROM @temp ) IF ( @cnt > 0 ) BEGIN       WHILE ( @cnt > 0 )                 BEGIN                       SELECT * FROM [TBL_Role] WHERE RoleID = ( SELECT RoleID FROM @temp WHERE ID = @cnt )

Format DateTime in Kendo UI Grid using ASP.Net MVC Wrapper

columns.Bound(p => p.CreatedDate). ClientTemplate ( "#= kendo.toString(kendo.parseDate(CreatedDate), 'dd-MM-yyyy hh:mm tt') #" ); OR template = #: kendo.toString(CreatedDate, ' dd-MM-yyyy hh:mm tt ') OR columns.Bound(p => p.CreatedDate).Title( "Created Date" ).Format( "{0:" + System.Globalization. CultureInfo .CurrentCulture. DateTimeFormat .ShortDatePattern + "}" ); OR columns.Bound(p => p.CreatedDate).Title( "CreatedDate" ).Format( "{0: dd-MM-yyyy hh:mm tt }" ) ;

get multiple checkbox value using jQuery

Hello every one, I am going to share the code-sample to get multiple  check-box  value using MVC 5 and jQuery. The code detail as given below. How to get multiple  check-box  value using jQuery? MVC 5 Razor code-sample @{     var users = new Users ().GetDefaultUsers(); } < div class ="demo-section k-content">     < ul class ="fieldlist">         @ if (users != null && users.Count > 0)         {             foreach ( var user in users)             {                 < li >                         < input type ="checkbox" name ="checkboxes" value =" @ user.ID " id ="Permission_ @ user.ID " checked ="checked">                     < label for ="Permission_ @ user.ID "> @ user.ID </ label >                 </ li >             }         }     </ ul > </ div > JavaScript code-sample

Progress bar in jQuery with Ajax

Hello everyone, I am going to share the code sample for display the progress image after Ajax call for ADD/UPDATE data. The example detail as given below. How to show progress bar while loading page in div using jQuery? HTML Code-Sample < div class ="loadingDiv"></ div > JavaScript Code-Sample //This is for loading the progress image.. $( "div.loadingDiv" ).html( '<div><img width="30px" src="' + lmageUrl + '" /></div>' ); $( "div.loadingDiv" ).show(); //This is for AJAX call.. executeAjaxRequestAsync(URLs, "POST" , data, success, null , null ); //This is for seccess call.. var success = function (data) {      if (data) {         $( "div.loadingDiv" ).hide();      } }                                                                           CSS Code-Sample .loadingDiv {     display : none ;     padding : 2px

Set Default Value to @Html.TextBoxFor MVC 5

Set Default Value to @Html.TextBoxFor MVC 5 Syntax for email text value @ Html. TextBoxFor (m => m.Email, new { @Value =ViewBag.Email }) Syntax for date type value @ Html.TextBoxFor(m => m.Date, new { @Value = ViewBag.Date, @Type = "date" }) Hope this help!

Rename database SQL Server using T-SQL

Query:  EXEC SP_RENAMEDB N'OLD_DB' , N'NEW_DB' ; When we execute SP_RENAMEDB sometime getting error messages. Error :   The database could not be exclusively locked  to perform the operation in SQL Server. The solution of above error to rename database SQL Server T-SQL USE [MASTER] ; GO ALTER DATABASE [OLD_DB] SET MULTI_USER   WITH ROLLBACK IMMEDIATE ; GO EXEC SP_RENAMEDB N'OLD_DB' , N'NEW_DB' ;

MVC Razor @foreach

Syntax :        @ foreach ( var user in users)      {  } Example in detail for @f or-each in MVC Razor < ul class ="dropdown-menu">     @ if (users != null && users.Count > 0)     {         foreach ( var user in users)         {             < li >< a href ="~/"> @ user.Name </ a ></ li >         }     } </ ul >

Technology News

Microsoft Visual Studio Code Is Open Source Now