Showing posts from 2015

Common Asp.Net Tips and Tricks 3

IntroductionThis is a series articles on ASP.NET Tips and Tricks. Under my previous article Common ASP.Net Tips and Tricks,we learned configuration tips and tricks. The article explained common exceptions we encounter while development and best practices for code implementation.
Tips and Tricks

LINQ to Entities does not recognize ToString

Sometimes LINQ to Entities does not recognize the method "System.String ToString()" and this method cannot be translated into a store expression.


This type of exception frequently occurs when we are working with LINQ or Entity Framework.

For example:
var result=dc.Tests.Where(i=>i.status==status.ToString()).FirstOrDefault();  
According to the preceding syntax, when we convert “status.ToString()”, in the where condition the exception "Expression not found such method in SQL" occurs where the condition returns an IQueryable result. So if we convert the result to IEnumerable, then the preceding type of exception never occurs.


Validate CKEditor using jQuery validate

Introduction In this article we learn about how to validate CKEditor control using jquery validate

Prerequisite. Below JavaScript library are used to validate CKEditor control.
Jquery-1.11.1.jsJquery.Vaidate.jsDescriptionWhen we configure CKEditor control in our html page it render in Iframe so jquery validate library fails to check weather this control is empty or not and we face issue while validating this control. Let’s see example:
HTML: <form> <textarea id="txtDemo1" name="txtDemo1"></textarea> <textarea id="txtDemo2" name="txtDemo2"></textarea> <input type="submit" value="submit"> </form>
Let’s assume we have configured CKEditor for both text area control and both fields are required in system. For validation we have implemented following validation for both control as shown below:

$("form").validate({ ignore: [], rules: { txtDemo1: { ckrequired: true /…

Common Asp.Net Tips and Tricks Part -2

In previous series of Asp.Net Tips and Tricks we learn basic configuration for Asp.Net application and exception handling. You can also visit Part-1In this article we learn new tips which is useful for both web form and Asp.Net MVC application. DescriptionIn this article we learn some tips which will helpful while we development. Problem: When we are using Response.Redirect method inside Try Catch Block ThreadAbortException occurs Solution 1: Response.Redirect(“redirectUrl”,false);

This method stops current execution of request and error is prevented.

Solution 2: Second way to prevent ThreadAbortException error is to handle error in try catch block
try { Response.Redirect(“redirectToSomeUrl”); } catch(ThreadAbortException e) { }
Problem:Server cannot set status after HTTP headers have been sent

Solution: This error occurs with number of reason in Asp.Net MVC application
When we use export to excel or any other format of export this type of error occurs t…

New Feature in Visual Studio 2015 RC

IntroductionIn this Visual Studio 2015 RC have major changes ever, an integrated suite of developer productivity tools, cloud services, and extensions that enable you and your team to create great apps and games for the web, for Windows Store, for the desktop, for Android, and for iOS. This article highlights some of the most important features in visual studio IDE.
New Feature in Visual Studio 2015 RC

Description  1)    Sign In across multiple accounts You can work with multiple user accounts in Visual Studio by adding them as you go or through the new Account Manager. Then, you can switch between those accounts on the fly when connecting to services or accessing online resources. Visual Studio remembers the accounts you add so you can use them from any instance of Visual Studio or Blend.

Figure1: You can add multiple accounts in visual studio by clicking on Add an account link

2)    Choose your target platform(s)
Visual Studio 2015 supports cross-platform mobile device development. You ca…

JUICE UI - ASP.NET Web Forms with jQuery UI

Introduction JUICE UI is open source ASP.NET Web Forms components for jQuery Widgets. We use all jQuery UI components like ASPX Server side control. Here we learn and use JUICE UI control in Aspx Web Form. JUICE UI Control also available for ASP.NET MVC Control also as helper method. Description
Juice UI requires .NET 4.0. Please ensure the proper version of .NET is installed before attempting to integrate Juice UI Controls. Juice UI can be installed through the NuGet Package Manager: PM> Install-Package Juice UI
Note: While use JUICE UI Control TargetControl attribute is required to set with ASPX Control ID. Before Use JUICE UI Control Add ScriptManager in Page. All jQuery Widget and JUICE UI Control have same attribute Date Picker Control<asp:TextBox runat="server" ID="txtDate" /> <juice:datepicker runat="server" targetcontrolid="txtDate" mindate="-20" maxdate="+1M +10D" />Juice UI Date Picker control support all …

Common Asp.Net Tips and Tricks

Introduction This article is useful for all developer who faces this type of exception in their software development time. Article also provides tips for common error. I will provide you solution of common exception and issue facing during development.
Tips and Tricks
1)500 Error occurs while publishing website in IIS. Most configuration error occurs because of this. Solution Figure1: Configuration Steps related to publish website in IIS Step 1: Choose appropriate application pool and if target framework is missing  in application pool then follow below steps as per your pc. Open command Prompt using Run as administrator Change the directory path for proper framework in command prompt CD C:\Windows\Microsoft.NET\Framework64\v4.0.30319
After changing directory path hit enter "aspnet_regiis i" this commandregister aspnet_regiis is available into directory. Step 2: Select proper publish code

Step 3: Check the Physical path is accessible for current user or IUSR by verify using “Test Sett…

Store Role in Form Authentication Cookie for SSO Authorization