Who is online?  82 guests and 0 members

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

Hajan Selmani

Restore your database from BAK file using SQL Server Management Studio 2005 / 2008

13 hours, 19 minutes ago by Hajan Selmani  -  Comments: 0  -  Views: [528]

In the following blog post, I will try to explain step by step about how to restore your database from BAK (backup) file using SQL Server Management Studio 2005 (or 2008). This is a STEP BY STEP explanation on how I did restore (the shortest way). Note: You don't need to have your new database (to which we will do restore) created in advance. 1. Open Microsoft SQL Server Management Studio 2005 2. Connect to the Server 3. You will have your databases I have created backup from my testDatabase . S...

Read More

Hajan Selmani

Video 'ASP.NET MVC 2: Basics, Introduction by Scott Hanselman' – MUST SEE!

9/1/2010 11:20:56 PM by Hajan Selmani  -  Comments: 0  -  Views: [708]

I have watched this video about one month ago (you can see my comment there) and I thought it would be very nice to share it with you. I consider this video MUST be seen by all developers, no matter of the level of experience because this is another great session held by the top-gun, Scott Hanselman, during the Microsoft DevDays 2010 in The Hague in The Netherlands. The video length is 1 hour, 13 minutes, 14 seconds – but once you start watching it, you will not see how quickly the time has pass...

Read More

Vivek Thakur

301 Redirect from default.aspx to site root

9/1/2010 4:49:14 PM by Vivek Thakur  -  Comments: 0  -  Views: [1005]

For efficient SEO, it is better that each URL should render unique data. So that means URLs having duplicate content, like http://mysite.com, http://www.mysite.com and http://www.mysite.com/default.aspx should be redirected to only a single URL having the same content. Scott Mitchell has a really nice article on this topic . But there is a catch! AFAIK, the code below (from the article) to redirect site.com/default.aspx to site.com/ will not work if there is a sub-directory involved: if (request...

Read More

Vivek Thakur

Do not buy MediaSoftPro component

9/1/2010 12:42:49 PM by Vivek Thakur  -  Comments: 7  -  Views: [3243]

**UPDATE** We finally got some decent reply from the MediaSoftPro programmer, and he has promised us to resolve all our support issues. We are happy with the support now, and I hope they continue to give the same support to all of their other customers as well. Some companies try hard to market their software products but do not care about support at all. MediaSoftPro seems to be one of them. They provide .NET based media encoding and publishing component, which is nothing but a wrapper around t...

Read More

Hajan Selmani

Working with System.IO.Path static class

8/30/2010 9:13:57 PM by Hajan Selmani  -  Comments: 0  -  Views: [245]

Hello everyone. Today, I was exploring the System.IO namespace in .NET 4.0 on an ASP.NET web application where I came to few changes related to the System.IO.Path static class. The Path class contains the same method names in .NET 2.0, 3.5 as well as 4.0, only (in .NET 4.0) new overloads are added to System.IO.Path.Combine() method. In the following blog post, I will show the usage of few methods belonging to the System.IO.Path static class, as well as, the changes in Combine() method added in ....

Read More

Raghav Khunger

Visual Studio: How to stop automatic insertion of ID tags of the controls in ASP.NET

8/27/2010 1:09:50 PM by Raghav Khunger  -  Comments: 1  -  Views: [638]

In this blog I will show how to stop automatic insertion of ID tags of the controls in ASP.NET. In many instances I don't like the automatic insertions of ID tags on my ASPX page, specially with case of literals. For example when you drag your control or double click the control from Visual Studio ToolBox on your form you will see this kind of picture: i.e ID tag is automatically inserted. Now how to stop that ? Below are the steps which will show you how to do it so : Select "Options" from the ...

Read More

neel pannu

Project Management - Basics

8/26/2010 10:50:28 AM by neel pannu  -  Comments: 2  -  Views: [1761]

Definition Ever tried defining the word “Project”? Or tried putting in words, what happens when a project is “ON”? What’s the difference between daily operations and a project? Could it be that a Public Relations Manager has daily operations AND Project Work to manage on the same day? The basic building block to understanding Project attributes is that any project is “temporary” and has a definite end. A project’s expected end, results in the generation of a product within a stipulated period of...

Read More

Hajan Selmani

Get all database table names, schemas and colum names with one SQL query

8/26/2010 8:27:00 AM by Hajan Selmani  -  Comments: 1  -  Views: [1212]

Imagine a database with more than 100 tables where you would have requirement to get all table names, their schema names and their column names. In the previous days, I've had requirement to query complete database and separate all table, schema and column objects in different table. There might be different reasons why you would like to create such (or similar) query. For example, my requirement was to translate the complete database tables, schemas and columns and create new table with the gen...

Read More

Hajan Selmani

Editing rows in SQL Server Management Studio 2008

8/25/2010 10:22:54 PM by Hajan Selmani  -  Comments: 0  -  Views: [605]

Hello everyone. In this blog post I will show one simple trick to configure the rows editing in SQL Server Management Studio 2008. So, when I work with MS SQL Server Management Studio, I perform all operations using SQL Statements (Select, Insert, Update, Delete). Today, I've had need to explain to team mate how to edit the sql server table rows. Because he is not familiar to working with SQL query language, I told him how to Edit the rows directly in the table in SQL Server Management Studio. T...

Read More

Raghav Khunger

ASP.NET: How to add custom controls to Visual Studio toolbox

8/25/2010 1:56:01 PM by Raghav Khunger  -  Comments: 1  -  Views: [875]

In this blog I will show how to add custom controls to Visual Studio toolbox. I always prefer to drag and drop or double click the controls icons from toolbox so that I can use those controls on my page. Now this is fine as per controls which come with Visual Studio, so what to do with the controls made by user own ? how to add them in the toolbox ?. Let's start with making a custom control first. We will make a custom textbox control which will derive from ASP.NET textbox control but will have ...

Read More

Raghav Khunger

List all the files of a particular extension in a directory

8/24/2010 9:01:08 PM by Raghav Khunger  -  Comments: 0  -  Views: [1046]

Yesterday, I saw a person posted a question on forums "How to get list of files having .txt extension inside a directory with c#". I thought I should blog for it. I decided to write a generic method which can be used for any extension. So I made a sample project to demonstrate the same. I have used FileInfo and DirectoryInfo class to achieve it. Below is the sample code: #region Using Directives using System; using System.IO; #endregion public class Example { const string DesiredExtension = "*.t...

Read More

Raghav Khunger

ASP.NET: How to open alert box from codebehind or server side

8/24/2010 9:00:02 PM by Raghav Khunger  -  Comments: 0  -  Views: [877]

Few days back a person asked on the forums on how to open alert box from codebehind or server side. Actually nothing is directly fired from server side in order to show the alert box but actually a script can be registered from server side in the page markup so that as the page loads in the browser an alert is shown. This can be done by "ClientScript.RegisterStartupScript" method. Below is the sample code: <%@ Page Language="C#" ValidateRequest="false" EnableEventValidation="false" %> <...

Read More

Raghav Khunger

Delete all the files and folders with C#

8/24/2010 8:59:57 PM by Raghav Khunger  -  Comments: 0  -  Views: [2041]

Yesterday, I saw a person posted a question on forums “How to delete all the files and folders inside a folder” with C#. I thought I should blog for it. So I made a sample project to demonstrate the same. I made a extension method which will delete all the files and folders inside a particular folder. Before going further you should read this: Source: http://weblogs.asp.net/scottgu/archive/2007/03/13/new-orcas-language-feature-extension-methods.aspx What are Extension Methods? Extension methods ...

Read More

Raghav Khunger

Search a text in all the stored procedures

8/24/2010 8:59:11 PM by Raghav Khunger  -  Comments: 2  -  Views: [706]

Today I was having a requirement where I need to search a text in all the stored procedures in my database. Basically I was in a need to get the list of all those stored procedures which contains a particular text. So I decided to blog for it. Below is the script for it: SELECT [ROUTINE_SCHEMA] , [ROUTINE_NAME] AS [PROCEDURE NAME] , [ROUTINE_DEFINITION] FROM [INFORMATION_SCHEMA].[ROUTINES] WHERE [ROUTINE_DEFINITION] LIKE '%searchtext%' AND [ROUTINE_TYPE] = 'PROCEDURE' ORDER BY [ROUTINE_SCHEMA] ,...

Read More

Hajan Selmani

Working with UDL (Universal Data Link) files

8/24/2010 8:10:16 PM by Hajan Selmani  -  Comments: 1  -  Views: [198]

Hello everyоne. After 3 long weeks of vacation, I'm finally back! I this blog post, I will show one simple method for creating connction strings using UDL files, as well as, how to use the UDL file directly from code-behind using C# language ( for those working in VB.NET ). Many juniors who have problems creating connection strings manually, use the Microsoft Visual Studio.NET Data Components like SqlDataSource, AccessDataSource or similar so that the Wizard will do the job for them and place th...

Read More

Raghav Khunger

C#: How to create database through C# code via ADO.NET

8/23/2010 4:08:30 PM by Raghav Khunger  -  Comments: 0  -  Views: [1701]

In this blog I will show how to create a new database through C# code via ADO.Net. In many applications it is needed to create a new database code via frontend so as not to touch the SSMS. Let's start with making a business entity of database object. We will need the following properties DatabaseName, MdfFileName, MdfFilePath, MdfFileSize, MdfMaxFileSize, MdfFileGrowth, LdfFileName, LdfFilePath, LdfFileSize, LdfMaxFileSize, LdfFileGrowth. Below is the source code for it : public class Database {...

Read More

Raghav Khunger

C#: How to get the total size of a directory

8/23/2010 4:07:42 PM by Raghav Khunger  -  Comments: 1  -  Views: [1852]

In this blog I will explain how to get the total size of a directory including all the nested folders and files inside it. In many requirements we need to traverse all the files inside a directory and apply some action on it, therefore I decided to go for a common method for it. This method will accept the directory path and action which is to be applied on each of the files inside that directory. Let's start with the code: #region Using Directives using System; using System.Collections.Generic;...

Read More

Raghav Khunger

ASP.NET: Request format is unrecognized for URL unexpectedly ending in methodname

8/22/2010 9:55:52 AM by Raghav Khunger  -  Comments: 0  -  Views: [1589]

Issue: "Request format is unrecognized for URL unexpectedly ending in methodname" This is the exception which many users get when they try to access web services from their web site running on .Net 1.1 version. From msdn http://support.microsoft.com/default.aspx?scid=kb;en-us;819267 "The .NET-connected Web services support HTTP GET, HTTP POST and SOAP protocols. By default, in .NET Framework 1.0, all three protocols are enabled. By default, in .NET Framework 1.1, HTTP GET and HTTP POST are both ...

Read More

Raghav Khunger

SQL: Display the maximum/largest of each group

8/22/2010 9:33:06 AM by Raghav Khunger  -  Comments: 0  -  Views: [1184]

Many times It Is required to find maximum/largest of count() from various counts on based on particular grouping. In this blog I will explain the same. I have given two samples below one for SQL 2000 and the other for SQL 2005 DECLARE @Test_Max TABLE ( [Id] INT , [Data] VARCHAR(30) , [Amount] INT ) INSERT INTO @Test_Max VALUES ( 1, 'Data1', 10 ) INSERT INTO @Test_Max VALUES ( 1, 'Data2', 20 ) INSERT INTO @Test_Max VALUES ( 1, 'Data3', 60 ) INSERT INTO @Test_Max VALUES ( 1, 'Data4', 15 ) INSERT I...

Read More

Sumit Arora

Enable/Disable input field using Jquery

8/22/2010 6:01:04 AM by Sumit Arora  -  Comments: 0  -  Views: [3101]

In this blog i will explain you how to enable/disable textbox using jquery. <html xmlns="http://www.w3.org/1999/xhtml"> <head > <title></title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> </head> <body> <form id="form1" runat="server"> <div> <input id="txtName" type="text" value="disabled" /> <asp:Button ID="btnCancel" runat="server" Text="Cancel" /> </div...

Read More

Sumit Arora

Value of dynamic textbox lost on Postback

8/22/2010 6:00:55 AM by Sumit Arora  -  Comments: 0  -  Views: [107]

In this blog I'll explain you how to retain the values of dynamically created textboxes on Postback. Few days back, I had to create dynamic textboxes on a button click event. There was one more button on that page on which I'd to save the values of the textboxes which I entered in those dynamicaly created textboxes. But on clicking the that button values of dynamic textboxes were becoming blank. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Enabl...

Read More

Sumit Arora

Convert C# code to VB.NET

8/22/2010 6:00:48 AM by Sumit Arora  -  Comments: 2  -  Views: [573]

Every one does search on google for code. At times we end up finding the code we were looking for but in some other languages such as VB.net, C++ etc. Now, that we have found the code but we want that code to be in some other language for ex C#. Someone who works in C# might not know about the syntax of VB.NET. So how to convert the code into the required language? As we all know that .Net framework finally converts the code whether it is written in C# or VB.Net into MSIL(Microsoft Intermediate ...

Read More

mohit kumar

Object reference not set to an instance of an object in .net

8/21/2010 7:57:02 PM by mohit kumar  -  Comments: 0  -  Views: [2662]

When programmers use and manipulations with a null object, they always faced an error. The error is ‘ Object reference not set to an instance of an object .’ In below example I will show you that how this error comes and how we can solve this problem. Error - Let’s say you are getting value from the database. When you are getting value from the database, you would get an about error. Now I am going to tell you why you have got this error. Example - <html xmlns="http://www.w3.org/1999/xhtml"&g...

Read More

Raghav Khunger

jQuery: Change or increase decrease the font size

8/21/2010 4:38:48 PM by Raghav Khunger  -  Comments: 0  -  Views: [2706]

You must have seen the font size controller generally at the top right corner of this web page to increase or decrease the text's font size as per your requirement. In this blog I will show you how to do the same and will show you how to increase or decrease the font size with jQuery. To explain it I have used two input buttons. One for increasing the font size and the other to decrease it. Below is the source code for it: <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title&...

Read More

Raghav Khunger

NOCOUNT in Sql

8/21/2010 4:19:37 PM by Raghav Khunger  -  Comments: 0  -  Views: [959]

Many programmers are unaware of the NOCOUNT feature in Sql. When there is so many DML operations (ie updates and inserts or deletes) it is good to set nocount to on. SQL server can become really talkative when this setting is off ie (SET NOCOUNT OFF), it will consume bandwith and CPU power. Below I am showing you with simple stored procedure on how to use NOCOUNT. GO CREATE TABLE TestTable1 ( id1 INT ) CREATE TABLE TestTable2 ( id2 INT ) GO INSERT TestTable1 VALUES ( 1 ) INSERT TestTable1 VALUES...

Read More

Top Bloggers

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: