Posts

Showing posts from February, 2016

Allow only numbers in textbox jquery

For allowing only numbers in textbox using jQuery, you can create key-press or key-down or key-up event for textbox by using textbox id or class. In below example i used class name ("number") for applying validation to textbox.  You just had copy above code and paste where you want to apply numeric validation. For allowin g numbers with decimal points  

Url rewrite for non-www to www in C#

WWW version is very useful to make your web site easily searchable by web crawler also WWW version helps to increase your chances make your web site rank higher in SEO purpose. One common use of URL Rewrite is redirecting http://domain.com to http://www.domain.com.  Many people are doing this for search engine optimization (SEO) so that search engines only see the one site, rather than two sites.  The goal is to set a permanent 301 redirect.  URL Rewrite works at the global level, or site level (or application level for that matter).  Where you apply it is really up to how you manage your server.  Either will work for a domain name redirect like this. You can choose to create the rules using IIS Manager, or using a text editor and updating web.config directly. For specifying non-WWW version to WWW version for your web site in C#.net, write below code in web.config inside system.webServer tag,

Check valid JSON String

Image
To check whether entered string is in valid json format or not. Use below link. Check Valid JSON If you entered valid json string it will show output as shown in below image : If you entered invalid json string it will show output as shown in above image

MVC CRUD Operations Using jQuery JSON and LINQ To SQL Class

Image
Step 1 : Database Create an EmployeeData table in a SQL database as in the following Step 2 : LINQ to SQL class Create a LINQ to SQL class to read data from the table as in the following: After using the Server Explorer and adding an EmployeeData table in the surface area as in the following: Now add a controller to the CRUD operations for EmployeeData. So open the Solution Explorer and right-click on the controller folder and add a controller as in the following: Step 3 : Controller  Now create a select controller, an insert controller, an edit controller and a the Delete controller as in the following: Step  4 : View Now create a view and a partialview on a right-click corresponding to the controller as in the following: 1. Index View (select data) In this figure see the view name is auto create, it's not changed. After selecting a Template and Model class as shown in the following figure. 2. Create View (Insert data) Create a vie