jalpesh

Stories submitted by jalpesh

Using transactions with LINQ-to-SQL(jalpesh.blogspot.com)

submitted by jalpeshjalpesh(1347) 2 years ago

Today one of my colleague asked that how we can use transactions with the LINQ-to-SQL Classes when we use more then one entities updated at same time. It was a good question. Here are the my answer for that.For ASP.NET 2.0 or higher version have a new class called TransactionScope which can be used to manage transaction with the LINQ. Let’s take a simple scenario we are having a shopping cart application in which we are storing details or particular order placed into the database using LINQ-to-SQL. The... read more...

add a comment |category: |Views: 15

tags: another

Google Translation API Integration in .NET(jalpesh.blogspot.com)

submitted by jalpeshjalpesh(1347) 2 years ago

Language localization is one of important thing of site of application nowadays. If you want your site or application more popular then other then it should support more then language. Some time it becomes difficult to translate all the sites into other languages so for i have found a great solution. Now you can use Google Translation API to translate your site or application dynamically. Here are steps you required to follow to integrate Google Translation API into Microsoft.NET Applications. First you... read more...

add a comment |category: |Views: 115

tags: another

Visual Studio 2010 New Feature-Generate From usage.(jalpesh.blogspot.com)

submitted by jalpeshjalpesh(1347) 2 years, 1 month ago

Visual Studio 2010 is Great IDE and I am exploring everyday a new things. Recently I was working with it and I have found a great features called Generate from usage. This feature is allow us to create a class from the generation from usage. Let’s take a sample example for that. Let’s Create a simple example where we will use a product class which is not there in project. Then from generate from usage feature we will create a product class. Here is code where product class does not exist in my console a... read more...

add a comment |category: |Views: 16

tags: another

Playing with Update Panel in asp.net(jalpesh.blogspot.com)

submitted by jalpeshjalpesh(1347) 2 years, 1 month ago

While taking interview for asp.net I often asked questions regarding update panel and how they works and how we can asynchronous post back using update panel without post backing whole page. To my surprise most of people don’t know how to use update panel using triggers. Let’s create simple example to demonstrate use of trigger. We will take one button and then we will use a textbox control and when button’s click event fires its will change textbox text value and fill textbox with that value. But lot... read more...

add a comment |category: |Views: 36

tags: another

Better View State Management in ASP.NET 4.0(jalpesh.blogspot.com)

submitted by jalpeshjalpesh(1347) 2 years, 1 month ago

ASP.NET is a great platform to develop any web applications. From ASP.NET 1.1 we are having one feature called View State which store the data in hidden field during page post back. Any Serializable data can be stored in View State. It’s scope is limited to page post backs.View state is great if you use it wisely otherwise it may create problem with performance page. I have seen that there were some page which contains lots of view state. It will increase your Kilo bytes of page and increase page renderi... read more...

add a comment |category: |Views: 42

tags: another

ASP.NET 4.0 –List View Control Enhancement(jalpesh.blogspot.com)

submitted by jalpeshjalpesh(1347) 2 years, 1 month ago

With asp.net 3.5 we are having a great control called list view its provide almost all the functionality like grid view and its rendering is also easy but in asp.net 3.5 you need to specify a layout template where in asp.net 4.0 layout template is not required. So no need to include one extra placeholder as layout template. Like in asp.net 3.5 you nee do render formview control like following. This can be replaced by following in asp.net 4.0. Now no need to for layout template like following. read more...

add a comment |category: |Views: 33

tags: another

ASP.NET 4.0-FormView Control Enhancement –RenderOuterTable Property(jalpesh.blogspot.com)

submitted by jalpeshjalpesh(1347) 2 years, 1 month ago

Form view control is part of asp.net standard control suite since asp.net 2.0. We are using it when we need to display one record at a time. ASP.NET 4.0 has made form view control more enhanced.Now its has a property called RenderOuterTable which will decide the whether outer table was render in form view or not. So now the html generated by formview control is more css friendly and easy to manage. Like following we can define the property of from view control. If we made redneroutertable=”false” then it... read more...

add a comment |category: |Views: 58

tags: another

How to call a web service from JavaScript with asp.net Ajax(jalpesh.blogspot.com)

submitted by jalpeshjalpesh(1347) 2 years, 1 month ago

Calling a web service from JavaScript was easy task earlier you need to create a proxy class for JavaScript and then you need to write lots of java script but with Microsoft ASP.NET Ajax you can call web services from JavaScript very easily with some line of JavaScript and even better you can also handle the errors if web service failed to return result. Let’s create a simple hello world web service which will print Hello world string and then we will call that web service into JavaScript. Following is... read more...

add a comment |category: |Views: 15

tags: another

.NET 4.0- A new method StringBuilder.Clear() to clear stringbuilder(jalpesh.blogspot.com)

submitted by jalpeshjalpesh(1347) 2 years, 2 months ago

With Microsoft.NET 4.0 we have a convenient method called clear method which will clear string builder. This method is very use full where we need to use string builder for multiple string manipulation. So we don’t need to create a separate string builder for it. Let’s take a simple example which will print string builder string before,after clear so we can see how it works. Following is simple console application for this. read more...

add a comment |category: |Views: 6

tags: another

Dynamically creating Meta Tag from ASP.NET 2.0/1.1(jalpesh.blogspot.com)

submitted by jalpeshjalpesh(1347) 2 years, 2 months ago

Search Engine optimization is very important to any web site today you can’t get more visitors except search engine optimization.In asp.net site we can also create dynamic meta tags as per our requirement for each page very easily. I will going to show you the two ways of adding meta tags dynamically one for asp.net 2.0 and other for any asp.net version. Lets look first that way and then we will look another way. First you have to add runat=”Server” in your head tag like following. Then you need to ... read more...

add a comment |category: |Views: 50

tags: another

How To Access Control On Master Page From Content Page(jalpesh.blogspot.com)

submitted by jalpeshjalpesh(1347) 2 years, 2 months ago

It a common requirement that you have change the master page content from content page. For example you have welcome label control that is there in master page and you want to change the welcome message after user logged in from the content page. Same way there might be another requirement like you need to bind a menu from content page as per user logged in having rights. In such kind of case use find control() method to access control on master page from the content page.You can find any control of mas... read more...

add a comment |category: |Views: 20

tags: another

ASP.NET- Using span tag instead of label for performance(jalpesh.blogspot.com)

submitted by jalpeshjalpesh(1347) 2 years, 2 months ago

In ASP.NET controls used in to the user controls are generate Client Id which unique for the control and If you have so many user controls hierarchy then you will have very long client id like ‘ctl00_CPH_ctl02_BM_userLogin_UserName’.It will increase the Kilo Bytes of html rendered in the browsers. Label control is the control which is used to display text and its render as span tag in the html render by the browser. So in such type of scenario if you have so many label controls then your html is going to... read more...

add a comment |category: |Views: 38

tags: another

IIS Error: The process cannot access the file because it is being used(jalpesh.blogspot.com)

submitted by jalpeshjalpesh(1347) 2 years, 2 months ago

Recently in our one of the web servers all the sites using port 80 were stopped and when we tried to restart website it was giving error like process cannot access the file because it is being used by another process. After analyzing and diagnosis and searching on internet for the same problem i have found that it was a problem due to port 80 was used by another process. To solve the problem i have following command which will list IPs,PID(Process ID) and port that used by the process. The command is ... read more...

add a comment |category: |Views: 31

tags: another

C# 4.0-string.IsNullOrWhiteSpace()(jalpesh.blogspot.com)

submitted by jalpeshjalpesh(1347) 2 years, 2 months ago

We have already has string.IsNullOrEmpty() method to check whether the string is null or empty.Now with Microsoft.NET Framework 4.0 there is a new another method that is that is called string.IsNullOrWhiteSpace() which will also check whether string is having whitespaces or not with null and empty string.This method is help full where we can check string is having whitespace rather then its empty or null. It will return a true if a string is empty,null or its having whitespaces. Let’s create a simple ... read more...

add a comment |category: |Views: 22

tags: another

C#-Constructors,Static Constructors and Destructors in Inheritance(jalpesh.blogspot.com)

submitted by jalpeshjalpesh(1347) 2 years, 2 months ago

While taking interview for .NET Technologies i often ask about the execution sequence of the constructor and destructor in inheritance but from the my experience still i have found that lots of people are confused with execution sequence of constructor and destructors. Lets create a simple example and learn some basic things that is very important while using inheritance in C#.Constructors will be executed in from parent to child sequence means first parent class constructor will be executed then after t... read more...

add a comment |category: |Views: 22

tags: another

Singleton Class in C#(jalpesh.blogspot.com)

submitted by jalpeshjalpesh(1347) 2 years, 2 months ago

Singleton pattern is very popular pattern used by programmer. The idea behind the singleton pattern is to have only one instance of a class at any time. This kind of pattern is very useful for for heavy resources like Linq Data Context etc. It is also useful in multithreaded application where different thread of application try to crate instance of one class but it should be thread safe. It can be also useful for global resources and state objects. In singleton class there are two things required. One s... read more...

add a comment |category: |Views: 40

tags: another