Loading ...

Who is online?  0 guests and 1 members
home  »  blogs  »  Vivek Thakur: December 2008

Communifire Blogs

Vivek Thakur :December 2008 postings

Vivek Thakur

Prevent Validators from firing upon button clicks

12/23/2008 by Vivek Thakur · 1 · 1264

Some junior programmers in my team were facing issues regarding ASP.NET validators. They wanted the validators NOT to fire on some button clicks on the same page. They did some google search and decided to use ValidationGroup for some reason. I saw the code and told them to use CauseValidation property of the asp.net buttons. This property, if set to false, will disable the validators fr...

Vivek Thakur

Architecture versus Design

12/22/2008 by Vivek Thakur · 1 · 1504

Being a member of the Technical Solutions Group (TSG) in our company, i was discussing/debating some concepts with other members and wanted to share the email thread so that I can have more feedback which will improve/correct my understanding too-:) ****************************EMAIL THREAD******************************************************* Hi all, Due to my extremely tight schedules,...

Vivek Thakur

Developer's Nightmare

12/22/2008 by Vivek Thakur · 0 · 1313

I was reading about LINQ and though it is a really nice technology but there is one big problem which has been cropping up in my mind since quiet some time: New technologies are coming at a much faster rate than developers can absorb. LINQ, DLINQ, Windows Communication Foundation, SOA (though this is related to Arch)... Developers today even face problems writing efficient code in ASP.NE...

Vivek Thakur

Running ASP.NET v1.1 and v2.0 on the same server

12/22/2008 by Vivek Thakur · 0 · 1587

Can we run both 1.1 and 2.0 web projects on the same Windows 2003 server? Many times I have answered this question on the forums , so thought of writing a post on the same. IIS 6.0 can run both ASP.NET 1.1 and 2.0 web applications simultaneously on the same server, if each version specific application is assigned a different application pool. Now what is an application pool? We know that...

Vivek Thakur

Error while trying to run project: Unable to start debugging on the web server. The project is not configured to be debugged.

12/22/2008 by Vivek Thakur · 0 · 4183

There are two common errors regarding VS 2003 projects. 1. Error while trying to run project: Unable to start debugging on the web server. The project is not configured to be debugged. First of all, make sure that in your Web.Config file, you have Debug=True in the Compilation property as: < compilation defaultLanguage ="c#" debug ="true" /> If your project still shows the same err...

Vivek Thakur

Export ASP.NET page to Word, Excel or PDF

12/22/2008 by Vivek Thakur · 2 · 8808

Many times we would like to export our page as an Excel sheet, Word doc or PDF file. This can be simply achieved by changing the ContentType of the Response object and overriding the RenderControl method of the control to be exported: Page Load() { //bind data to data bound controls and do other stuff Response.Clear(); //this clears the Response of any headers or previous output Response...

Vivek Thakur

MasterPage and viewstate issue

12/22/2008 by Vivek Thakur · 0 · 6729

There is an excellent article on MasterPages by Scott Allen in which the potential gotchas while working with MasterPages are explained very well. This article complements the article by Scott and focusses on the issue regarding enabling/disabling the ViewState while dealing with Master and Content pages in ASP.NET 2.0. MasterPage is treated like a control in the ContentPages Recently I ...

Vivek Thakur

FormsAuthentication Persistent Cookies Crippled in ASP.NET 2.0?

12/22/2008 by Vivek Thakur · 0 · 2075

I was answering a query related to FormsAuthentication in ASP.NET 2.0 and got to know that the persistent cookies behavior has been changed in 2.0, means that they take the " timeout " value from the web.config file (even if we manually set the cookies expiry time). The documentation in MSDN( http://msdn2.microsoft.com/en-us/library/1d3t3c61.aspx ) is also incorrect in my opinion, which ...

Vivek Thakur

Inline SQL queries or Stored Procedures: Yet-another-(healthy) Debate

12/22/2008 by Vivek Thakur · 0 · 1684

Which is better: SQL queries in code or SPs? There is ofcourse no general answer but there are scenarios when one appraoch can be better than the other, or when a mixed approach can be employed. Let's say we have a an app which does standard CRUD operations and has no data intensive methods. In this case I would recommend using SQL queries because: 1. The code would be more maintainable,...

Vivek Thakur

Do Certifications really help?

12/22/2008 by Vivek Thakur · 0 · 709

Recently we introduced a new policy in our company. All our exisiting technical employees need to be certified (either in Java or .NET) and the new employees will also need to give the certification within a month of joining. I spear headed this rule because based on my experience I strongly felt that this step could seriously improve the technical knowledge of our developers and also ex...

Vivek Thakur

Too many characters in character literal error while adding client side events

12/22/2008 by Vivek Thakur · 1 · 10069

In ASP.NET, when we try to add client side script on events such as onclick and onload to controls with runat="server", we will get this error: Error 1 Too many characters in character literal For example, see this code: < form id ="form1" runat ="server" onload ="alert('Will not work!')" > Compiling it will result in the error above. As another example, see the HTML code below: &l...

Vivek Thakur

Database and web server on the same machine

12/22/2008 by Vivek Thakur · 0 · 1176

One of my friends said that he always favor DB on a separate machine instead of having it on the same machine as the web server. I also had a discussion on the same in the ASP.NET forums, where I realized that most developers think on the same lines as my friend. This was a bit surprising as logically speaking, having a DB on a different machine will lead to extra network trip, which wil...

Vivek Thakur

'Disable' Back Browser Button ASP.NET

12/22/2008 by Vivek Thakur · 7 · 21692

The "Back" browser button (or for that matter any other browser button) cannot be actually disabled by a web application as the security context will not allow this (think of what nasty things could happen if web applications can remove buttons from client browsers!) What we can do is to somehow make sure that browser does not cache the web pages (which will cause the"Back" "Forward" but...

Vivek Thakur

Microsoft ASP.NET MVP Award

12/22/2008 by Vivek Thakur · 1 · 599

Today I got a pleasant surprise when I recieved an email from MS stating that I have been awarded Microsoft MVP Award (ASP.NET) for 2007!! I still can't digest the news !! MVP award is like a dream for most of us developers and I really feel priviledged. I hope to continue helping out users on ASP.NET forums as well as writing more technical articles and in the process continue learning ...

Vivek Thakur

PostBack in Classic ASP

12/22/2008 by Vivek Thakur · 0 · 5205

Many of the "new" developers might not value the ASP.NET framework when compared to classic ASP (ASP 3.0). Life was really tough and "messy" in the old days when just to post data on a form intermediate forms were used. Even a simple thing like IsPostBack property in ASP.NET was not available in ASP. Recently I was working on a community project which had a particular section coded in AS...

Vivek Thakur

Few Points on VarChar and NVarchar in SQL Server

12/22/2008 by Vivek Thakur · 1 · 4462

First of all, the basic difference between a varchar and a nvarchar datatype is that for each variable the latter one takes double the space needed by the former one. Now why double? Because of the extra "n", which means that it *can* store Unicode characters as well. Unicode characters represent a wide variety of foreign locales and many times they need an extra byte for the same char s...

Vivek Thakur

Legal Action against MVP by MS

12/22/2008 by Vivek Thakur · 0 · 846

The creator of TestDriven.NET faces legal action for supporting VS Express Edition: http://www.theregister.com/2007/06/05/microsoft_mvp_threats/ Your views?

Vivek Thakur

DateTime in C#: Different Formats

12/22/2008 by Vivek Thakur · 1 · 10980

Here are a few handy string formats to convert a given datetime to custom formats: //save today's date in a string string date = DateTime.Now.Date; 1. Show Date as " Friday 13 August 2003" date.DayOfWeek + " " + date.Day + " " + date.ToString("MMMM") + " " + date.Year.ToString() 2. Show date as "Friday 13 August 13:00:13" //time in 24H format date.DayOfWeek + " " + date.Day + " " + date....

Vivek Thakur

Creating RSS and ATOM feeds in C#

12/22/2008 by Vivek Thakur · 0 · 979

Below are some really helpful links on how to create RSS and ATOM XML feeds in C#: Creating RSS XML feeds: http://www.primaryobjects.com/CMS/Article67.aspx Creating ATOM XML feed: http://www.codeguru.com/csharp/csharp/cs_network/internetweb/article.php/c12711/ Basics of RSS/ATOM: http://www.sitepronews.com/archives/2007/jan/24.html

Vivek Thakur

RegisterclientScript block in ASP.NET 2.0

12/22/2008 by Vivek Thakur · 0 · 2395

In ASP.NET 2.0, a new class ClientScriptManager is introduced and the old method Page.RegisterClientScriptBlock is deprecated. Below is some sample code to register client script from an ASP.NET page: if (!ClientScript.IsClientScriptBlockRegistered( "ClosePopUp" )) { ClientScript.RegisterClientScriptBlock( this .GetType(), "ClosePopUp" , "your javascript code goes here"); } Note the GetT...

Vivek Thakur

SilverLight and Expression products intorduction for newbiews

12/22/2008 by Vivek Thakur · 0 · 1496

There is a lot of technical jargon as well as tool names floating around on the net when one tries to search for silverlight. So I thought of writing a very basic introduction covering Silverlight, WPF/E, Expression Blend, Expression Web, Exprression studio, .NET 3.0 WPF etc. Since I got some good experience buildng a nice Silverlight based website I wanted to share my knowledge so that ...

Vivek Thakur

Dummy Credit Card Numbers for Testing

12/22/2008 by Vivek Thakur · 1 · 4416

Here is a list of dummy credit card number that can be used while testing your applications involving credit card transactions: Visa: 4111-1111-1111-1111 MasterCard: 5431-1111-1111-1111 Amex: 341-1111-1111-1111 Discover: 6011-6011-6011-6611 Credit Card Prefix Numbers : Visa: 13 or 16 numbers starting with 4 MasterCard: 16 numbers starting with 5 Discover: 16 numbers starting with 6011 AM...

Vivek Thakur

COALESCE function in SQL

12/22/2008 by Vivek Thakur · 0 · 1309

COALESCE(arg1,arg2,...) is a pretty useful function in SQL. Suppose we have a table A having 3 columns FullName, CompleteName and DisplayName. Any of these columns can contain null values. Now we want to select the DisplayName from this table, but if it is null, then return FullName, if that is also null then return CompleteName. We can easily perform the same in one select statement as:...

Vivek Thakur

Expiring Response to disable Back Button functionality

12/22/2008 by Vivek Thakur · 0 · 1803

Sometimes while clicking the Back browser button we would like the browser not to load the "cached" web page and get the fresh page from the server instead. This might be required in cases where we don't want to show user selected values in the previous page, or have some code in the previous page which we would like to run each time that page is accessed. In ASP.NET 1.x, we can expire t...

Vivek Thakur

"Disable" Back Browser Button ASP.NET

12/1/2008 by Vivek Thakur · 0 · 2206

The "Back" browser button (or for that matter any other browser button) cannot be actually disabled by a web application as the security context will not allow this (think of what nasty things could happen if web applications can remove buttons from client browsers!) What we can do is to somehow make sure that browser does not cache the web pages (which will cause the"Back" "Forward" but...

  • Page 1 of 2 (28 items)
  • « Previous 
  • 1
  • 2
  • Next »
  •   Go to page:  [Go]

Product Spotlight

ASP.NET Hosting Spotlight

Join CodeAsp.Net for FREE Today!

It's fast, easy and free! Submit articles, get your own blog, ask questions & give answers in the forums, and become a better developer, faster.

enter your email address:

 

Quick Vote

What kind of email newsletter would you prefer to receive from CodeAsp.Net?