Posts

Showing posts from 2012

Creating Dynamic Controls in JavaScript

Creating dynamic controls in javascript will provide us a great feature for our websites that too will give a flexible data entry pages.  For creating controls dynamically in javascript we can follow some basic rules like - Createing a method for creating a particular control.  We can use this method for creating that particular control in our whole project. Creating controls in javascript can be done by using "document.createElement()" method by passing tag name as parameter as follows for example if we want to create a textbox or some input fields, then the code will be as follows var  textBox = document.createElement( 'input' ); then by adding setAttribute method for that control we can set various attributes for that control. Here the code for this Creating TextBox i.e., input text field: function CreateTextBox(id, value) {     var textBox = document.createElement( 'input' );     textBox.setAttribute( "type" , "text&

THREE TIRE ARCHITECTURE

Click Here to download sample project A three tire architecture application is divided into three platforms namely Data Access Layer, Business Layer and Presentation Layer. Data Access Layer (DAL): This layer performs the operations related to data transfer between business layer and database. Business Layer (BL): This layer performs business logics if necessary or else it just transfers data between the presentation layer and data access layer. Presentation Layer: This layer is used to display the related data to the users.  This layer gets or supplies necessary data to the business layer and presents it to the user with the respective presentation technology. Advantages of Three tire Architecture : Code Reusability – After writing DAL or BL these logics can be used for any kind of technologies in dotnet.   For example, if you are developing a social networking site in three tire architecture and if you choose asp.net as your front end technology then the

Parsing Json in Asp.net

var obj = JSON.parse(Jsonresult);             for (var key in obj) {                 if (obj.hasOwnProperty(key)) {                     var value = obj[key];                    alert(value.CustomerID);                 }             }             document.getElementById('result').innerHTML = html;

Truncating tables which are bounded with foreign keys

Image
Truncating a table having primary key and the field is referenced to the some other field of some other table for the foreign key relationship is not possible by using ‘Truncate’ command alone.   This will gives the following error Cannot truncate table 'tbl_Parent' because it is being referenced by a FOREIGN KEY constraint. Here I’ll explain how to do this with an example Steps:    Delete all the foreign key constraints   Truncate the tables   Again create all the foreign key constraints These are the steps for clearing the database values using the truncate command while using foreign keys. Example: Lets create a database as in the following diagram Here the ParentId in the tbl_Child is the foreign key for the field ParentId in the tbl_Patrent which is a primary key. Not for truncating all the tables the procedure will be as follows CREATE PROC sp_DropDB AS BEGIN       BEGIN TRY                   BEGIN T

Recover or Restore SQLServer Database from Suspect Mode

     Is your SQL Server database is marked with "Suspece", then your database is in suspect mode.      When your project's Database is in Suspect mode, then you are not able to do any transactions from the database.  This will leads your brain to a big tension mode.  Don't worry, Here are the steps to restore your SQL Server database from Suspect Mode back to Operational Mode. Run the below script by replacing the text "your database name" to Your database name which you need to restore. There will not be any data loss.  I have tried two times on my local database and also in the live database. EXEC sp_resetstatus ' your database name '; ALTER DATABASE  your database name  SET EMERGENCY DBCC checkdb(' your database name ') ALTER DATABASE  your database name  SET SINGLE_USER WITH ROLLBACK IMMEDIATE DBCC CheckDB (' your database name ', REPAIR_ALLOW_DATA_LOSS) ALTER DATABASE  your database name  SET MULTI_USER HAPPY

Grid View Demo

Download the Sample Project Explanation will follow shortly...

Localizing an ASP.NET Application

Globalization is the process of designing and developing applications that function for multiple cultures, and localization is the process of customizing your application for a given culture and locale. The topics in this section describe how to create ASP.NET Web applications that can be adapted to different languages and cultures. Example for Localization:- Imports System.Threading.Thread Imports System.Threading Public Class Globalization     Public Sub New()         ' Creating a Global Culture specific to our application.         Dim cultureInfo As New System.Globalization.CultureInfo("en-US")         ' Creating the DateTime Information specific to our application.         Dim dateTimeInfo As New System.Globalization.DateTimeFormatInfo()         ' Defining various date and time formats.         dateTimeInfo.DateSeparator = "/"         dateTimeInfo.LongDatePattern = "MM/dd/yyyy"         dateTimeInfo.ShortDatePattern = "MM/dd/yyyy"