home » blogs

ASP.NET Blogs

CodeAsp.Net's ASP.NET Blogs is more than just a social community for ASP.NET bloggers - we are one of the largest ASP.NET blog directories on the internet. Whether you are looking to search ASP.NET blogs, connect with ASP.NET bloggers, learn more about ASP.NET, or promote your own blog, CodeAsp.Net is for you. Be sure to check back often as we add new ASP.NET blog postings frequently.

Blogs RSS Feed

ASP.NET Blogs: Most Recent postings

Javascript: Copy methods from one class to other

7/25/2010 5:57:10 PM by raghav_khunger   -   1 Comments   -   Views: 53

Few days back a person was asking on forums on how to copy the methods from one class to other in Javascript. Yes, it sounds interesting. You can make use of object oriented techniques in Javascript to make robust and well maintained applications. So come to the question which the OP asked. I have created a sample code to accomplish it. In this example I have used a source class (SourceClass.js) , a target class (TargetClass.js) , a utility script (Utility.js) which is having the heart of the co...

Read More

C#: Find the maximum key from a dictionary

7/25/2010 2:44:11 PM by raghav_khunger   -   0 Comments   -   Views: 69

Yesterday a person asked on the forums on how to find the maximum key from a dictionary. He needs to perform some logic after finding the maximum key so I gave him the solution to use Max of LINQ. Below is the code for it : #region Using Directives using System; using System.Collections.Generic; using System.Linq; #endregion public class Example { class Test { static void Main() { var dictionary = new Dictionary<int, string> {{1, "one"}, {2, "two"}, {3, "three"}, {4, "four"}, }; var maxKey...

Read More

Red gates sql prompt: How to stop qualifying the objects name with the owner name

7/25/2010 2:09:58 PM by raghav_khunger   -   0 Comments   -   Views: 31

I like working with "Red Gates" tools, they are awesome. SQL Prompt (one of their tools) is a code auto-completion and formatting tool for writing SQL queries. While working with SQL prompt I noticed that it automatically qualify object names with owner name .i.e if the owner name is "dbo" it makes the query like this: Select * from dbo.mytable As you are seeing dbo has been added while qualifying objects. I need to remove this feature as I don't want to put restrictions on the clients to have t...

Read More

Literal control in ASP.NET

7/22/2010 6:10:11 PM by mohit   -   7 Comments   -   Views: 99

In this blog I will explain Literal control in ASP.NET. The Literal control used to display static text on a web page. Literal control is not rendered as a <span> tag like label control. The Literal control doesn’t inherit from WebControl and we can’t apply style to its content because it doesn’t have a style property. There is a Mode property of Literal control. There are three modes available in literal control – Encode Mode – If I set Encode Mode, HTML tags and script is treated like te...

Read More

Calculate First and Last Day of Month

7/22/2010 4:01:43 AM by hajan   -   0 Comments   -   Views: 181

This is pretty simple, but a bit tricky for those that haven't tried it yet, so I would like to document it here :). You may be in need to calculate the first or last day of the month in your ASP.NET application. The method is simple (but still tricky for beginners). Here is the code DateTime dateNow = DateTime.Now; //create DateTime with current date string firstDayDate = dateNow.AddDays(-(dateNow.Day - 1)).ToString(); //first day dateNow = dateNow.AddMonths(1); string lastDay = dateNow.AddDays...

Read More

Integration of JQuery DatePicker on ASP.NET Website – Validation Script (part 2)

7/20/2010 7:44:18 PM by hajan   -   0 Comments   -   Views: 139

In part 1 I’ve shown the way to integrate the KeithWood’s JQuery DatePicker on an ASP.NET website in just few simple steps. In this blog post I’m going to do something more advanced comparing with the part 1 blog post, but still, I will stick enough clear with the code and explanation to make this simple for everyone (not only for JS Ninjas). The script will do the following things: Validate date string Validate startdate and enddate logic ( !(startdate>enddate) ) Validate empty text boxes Cr...

Read More

Checking the existence of dictionary keys

7/20/2010 7:44:16 PM by hajan   -   1 Comments   -   Views: 145

Dictionary is an interesting mechanism which provides us very good way to associate keys and values on a simple manner. Key/Values can be of any type. I won't get into explaining what is (or what is not) a Dictionary, but this blog's focus is about one common mistake that I've seen constantly made by juniors and beginners in C# & ASP.NET. Let's say we have the following code block: Dictionary<string, string> dict = new Dictionary<string, string>(); dict.Add("name", "Hajan"); dict...

Read More

Date validation using regular expression

7/20/2010 11:39:21 AM by hajan   -   0 Comments   -   Views: 184

If we want to validate dates, using regular expression is quite simple. The regular expression is: /^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/ - It finds as valid the following date formats: mm-dd-yyyy, mm.dd.yyyy, mm/dd/yyyy, dd-mm-yyyy, dd.mm.yyyy, dd/mm/yyyy. So, the date values can be separated either by '-', '.' or '/' - first two can be either one or two digits, second two again one or two digits and the third exactly four digits. Here are some example implementations. JavaScript <script langua...

Read More

Splitting date using JavaScript

7/19/2010 2:39:26 PM by hajan   -   0 Comments   -   Views: 104

Splitting strings (in our case date format string) using JavaScript is very easy. If you are already familiar with the .NET languages (C#, VB.NET), you will see that this is almost the same way. Take a look at the following ASPX code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>CodeASP.NET Community - http://codeasp.net/bl...

Read More

Common Logon 0.1A

7/18/2010 2:27:29 PM by TATWORTH   -   0 Comments   -   Views: 72

I have just published version 0.1A of CommonLogon at http://commonlogon.codeplex.com/ . It is a user authentication system for Extranet Web sites. CommonLogon is a mechanism for Extranet web sites to have a user logon process of the scope found for network logon but with extensions for the web such as the ability to restrict logons for a given account against IP Address. Common Logon Features Passwords stored as hash Password complexity rules Password aging Optional restriction of any account by...

Read More

Top Blog Contributors

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: