Skip to main content

Posts

Showing posts from May, 2014

Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Could not load type ‘System.ServiceModel.Activation.HttpModule’ from assembly ‘System.ServiceModel, Version=3. 0 . 0 . 0 , Culture=neutral, PublicKeyToken=b77a5c561934e089′. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.TypeLoadException: Could not load type ‘System.ServiceModel.Activation.HttpModule’ from assembly ‘System.ServiceModel, Version=3. 0 . 0 . 0 , Culture=neutral, PublicKeyToken=b77a5c561934e089′. Solution : You need to run aspnet_regiis.exe for both .NET Framework v2 and v4. This can be accomplished by using the –iru parameters when running aspnet_regiis.exe as follows: aspnet_regiis.exe -iru start-> Run--> c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -iru

Kendo UI File Uploading Client Side Validation

In Kendo UI async file uploading there is no option to make some client side validation like: No of files you can upload at a time Size of the file Extension of your uploading file               So, how we can achieve this ? So, to know that see the javascript code snippet below. I am going to explain that. $ ( '#selectedFiles-edit-win' ). kendoUpload ({ multiple : true , localization : { select : 'Select File(s)' }, async : { saveUrl : "/CFCS/AjaxFactory.cfc?method=uploadFile" , removeUrl : "/CFCS/AjaxFactory.cfc?method=cancelUploadedFile" , autoUpload : true }, select : function ( e ) { var files = e . files ; if ( files . length > 10 ) { alert ( "Maximum 10 files can be uploaded at a time." ); e . preventDefault (); return false ; }   for ( var fileCntr = 0 ; fileCntr < files . length ; fileCntr ++ ) { if ( files [ fileCntr ]. s...

MVC: How to display validation messages with javascript alert window?

For the unobtrusive client validation you could subscribe to the  showErrors  callback and display the errors the way you want ( alert  in your case): ( function ( $ ) { $ . validator . setDefaults ({ onsubmit : true , onkeyup : false , onfocusout : false , showErrors : function ( errorMap , errorList ) { if ( errorList . length > 0 ) { var errors = errorList . map ( function ( element ) { return element . message ; }). join ( '\r\n' ); alert ( errors ); } } }); })( jQuery ); In order to display server side errors with  alert  on the client you shouldn't be using the  @Html.ValidationSummary( true )  helper because this helper outputs the errors directly in the view and you said that you don't have enough place. So you could emit javascript dynamically when there are errors and...

How to create index in sql

SQL - Retrieve data pagewise CREATE TABLE tblContact ( Id INT IDENTITY(1,1)       , FirstName NVARCHAR(10)       , LastName NVARCHAR(10)       , Address NVARCHAR(10)       , Tel_no NVARCHAR(10) )  GO CREATE PROCEDURE [dbo].[GetAllContacts]  @searchVal VARCHAR(500),  @page INT = NULL,  @perPage INT = NULL AS DECLARE @Start INT, @End INT SET @page = ISNULL(@page, 1) SET @perPage = ISNULL(@perPage, 10) SET @start = CASE WHEN @page = 1 THEN 0 ELSE (@page - 1) * @perPage END + 1 SET @end =  CASE WHEN @page = 1 THEN @perPage ELSE (@page * @perPage) END ;WITH [Contacts] AS ( SELECT [Id]  , [FirstName]  , [LastName]  , [Address]  , [Tel_no]  , ROW_NUMBER( ) OVER (ORDER BY LastName) AS [Index] FROM    [tblContact] WHERE ([FirstName] LIKE ('%'+ @searchVal +'%') OR [LastName]  LI...

Stop all active ajax requests in jQuery

// Automatically cancel unfinished ajax requests // when the user navigates elsewhere. ( function ( $ ) { var xhrPool = []; $ ( document ). ajaxSend ( function ( e , jqXHR , options ){ xhrPool . push ( jqXHR ); }); $ ( document ). ajaxComplete ( function ( e , jqXHR , options ) { xhrPool = $ . grep ( xhrPool , function ( x ){ return x != jqXHR }); }); var abort = function () { $ . each ( xhrPool , function ( idx , jqXHR ) { jqXHR . abort (); }); }; var oldbeforeunload = window . onbeforeunload ; window . onbeforeunload = function () { var r = oldbeforeunload ? oldbeforeunload () : undefined ; if ( r == undefined ) { // only cancel requests if there is no prompt to stay on the page // if there is a prompt, it will likely give the requests enough time to finish abort (); } return r ; } })( jQuery ); Ref :  http://stackoverflow.com/questions/1802936/...

How do you kill all current connections to a SQL Server 2005 database?

USE master go DECLARE @ dbname sysname SET @ dbname = 'yourdbname' DECLARE @ spid int SELECT @ spid = min ( spid ) from master . dbo . sysprocesses where dbid = db_id (@ dbname ) WHILE @ spid IS NOT NULL BEGIN EXECUTE ( 'KILL ' + @ spid ) SELECT @ spid = min ( spid ) from master . dbo . sysprocesses where dbid = db_id (@ dbname ) AND spid > @ spid END Ref :  http://stackoverflow.com/questions/11620/how-do-you-kill-all-current-connections-to-a-sql-server-2005-database