Triggering onClick Event from JavaScript Using Jquery.

Hello Friend's,

In one of my application I need to call 'Save' button click from Javascript.

Below is approach which I have used to call click event of 'Save' button.


More you can read about this click Events at

We can also bind this click event css class.

Example :-


Posted in | 0 comments

NHibernate.MappingException: Could not compile the mapping document

Error Message

NHibernate.MappingException: Could not compile the mapping document: Nhibernate.
User.hbm.xml ---> NHibernate.MappingException: persistent class Nhibernate.User,
 Nhibernate not found ---> System.TypeLoadException: Could not load type 'Nhiber
nate.User' from assembly 'NHibernate, Version=, Culture=neutral, Publi



This error message point to that the compiler does not know the Nhibernate.User class. 

You should check if you have deployed and referred your assembly correctly. 

Also need to check if you have included the correct name space.

Hope this will help you.

Posted in | 0 comments

Call Stored Procedure from Entity Framework

First Create an edmx file.

Double click your edmx file and right click your model,Choose Function Import In the pop-up dialog,

Choose the SP that you want to import as a function.

Now you can use it through the database Context like below.

using (EntityContext ec = new EntityContext())


    ec.StoredProcdure here(Parameters);


You can also refer below articles for same.

For Database First / Model First you can set up EF to call the SPs automatically:

For Code First you have to call them manually:

Posted in | 0 comments

how to check Null (isDBNull) in C# Data table and Empty string.

how to check Null (isDBNull) in C# Datatable

IsNull method of the DataRow is use to check null value.


     foreach (DataRow row in table.Rows)
           if (row.IsNull("id"))

Similer IsNullOrEmpty method is use to check string value null or empty.


  public static void Main() 
    string s1 = "abcd";
    string s2 = "";
    string s3 = null;

    Console.WriteLine("String s1 {0}.", Test(s1));
    Console.WriteLine("String s2 {0}.", Test(s2));
    Console.WriteLine("String s3 {0}.", Test(s3));

    public static String Test(string s)
    if (String.IsNullOrEmpty(s)) 
        return "is null or empty";
        return String.Format("(\"{0}\") is neither null nor empty", s);

Posted in | 0 comments

AddMvc() method not found.


Many developer do faces this problem during development.

Here some guideline to resolve this error.

1. On VS 2015, Tools >> Options >> Nuget Package Manager >> Package Sources, add

2. Implemention should be as shown below.

using Microsoft.AspNet.Mvc;

using Microsoft.AspNet.Routing;

using Microsoft.AspNet.Security.DataProtection;

using Microsoft.Framework.ConfigurationModel;

namespace Microsoft.Framework.DependencyInjection


  public static class MvcServiceCollectionExtensions


    public static IServiceCollection AddMvc(this IServiceCollection services, IConfiguration configuration = null)


      ConfigureDefaultServices(services, configuration);


      return services;


    private static void ConfigureDefaultServices(IServiceCollection services, IConfiguration configuration)






      services.Configure<RouteOptions>(routeOptions =>







For more this code refer below link

3. If the executing request is a POST then it will try to find a method RandomSponsor acceptimg HttpPost. If make sense, you could remove HttpGet and that should do the trick.
This can also happen if you have many layers of calls that start with a POST (I had an action returning a view returning a partial view calling RenderAction), then the call to RenderAction will still look for a POST method.

Hope this will help you.

Posted in | 0 comments