Saturday, June 20, 2009

Download Free real-estate website templates

Please visit my new Web Site

Why you design a template? Its completely waste your valuable time as well as money. Just pick a concept from various free template sites or direct download free template & start works. It will save your time & money also. In this post i will list down few free real-estate site template. From those site just download free templates for the developers company & in next day deliver the project. Encash your money ASAP. Not a bad technique at all. Client will be happy if you can provide a professional look template. The another reason is the REAL ESTATE company will never give you handsome money. So dont waste your time for template & give more time for SEO optimization, find a Free Template from my list below:

Free Real Estate Template #1:
This is a generic high quality graphics template for a real estate company or a developers company. This template has these objects: HTML, Photo, CSS.

Preview & Download

Free real estate site template 1

Free Real Estate Template #2:
This is also a high quality graphics template. You can use this template for real estate company. This site will also allow you to download the full design. This template has these objects: HTML, Photo, CSS & Photoshop file.

Preview & Download

Free real estate site template 2

Free Real Estate Template #3:
This is another high quality graphics template. Sources available for PSD (Photoshop CS+), HTML (Macromedia Dreamweaver / Microsoft Frontpage), CSS & Fonts.

Preview & Download

Free real estate site template 3

Free Real Estate Template #4:
This is another high quality & high resolution graphics template. Sources available for PSD (Photoshop CS+), HTML (Macromedia Dreamweaver / Microsoft Frontpage), CSS & Fonts. Its a FLASH template with embeded sounds. You can see a preview for this FLASH template by clicking below:

Flash Preview Download

Free real estate site template 3

Free Real Estate Template #5:
This is also another good design. You can try this one. This template has these objects: Photoshop file, CSS, pics etc.

Preview & Download

Free real estate site template 5

Hope now you can Design a template for real estate or developers within a day. Just download the templates that you want & then do few modifications before deployment. I always download free templates then did few modifications & then deliver the project. Because programmers has not enough time to design a template instead of coding. Since some great designers will provide us free template why dont grave it? And put your extra effort on SEO to increase site traffic.

Thursday, June 18, 2009

ASP.NET error: Unable to start debugging on the web server

Please visit my new Web Site

Unable to start debugging on the web server is a most common error in our arena. If it comes means something wrong in your web server configuration. Unable to start debugging on the web server error appears for many reason. If you check the next line of this error message commonly you will get two information like:

1. The web server is not configured correctly.
2. You do not have permission to debug the application.

Ok now find the solution for the above two errors.

The web server is not configured correctly:
Most of the times i found that in IIS Framework version was wrong. So ensure appropriate version for your application is mandatory. If you use VS 2005 then you application never run on the version of 2003 or 2008. Follow the follwing steps to set appropriate framework for your web application in IIS:

1. Right click on my computer.
2. Click on Manage
3. Expand Internet information services.
4. Find your application.
5. Right click to go to Properties.
6. Click on Asp.Net Tab & select appropriate version.

One another problem i found is some times the application directory does not registered as a web application. To fix this problem follow the below steps:

1. Follow up to 5 steps from above stated steps for solution 1.
2. By default you found Virtual Directory tab selected. If you found Create button next to the application name then click. After the completion of registration the button caption will be changed to Remove.

Do not have permission to debug the application:
Add account to the Debugger Users group. To do that go to the control panel then select users. Now check whether the user within the Debugger group or not. If not then select as a debugger.

If you found "The URL for this project is in the Internet zone" within the error message then the solution is:

1. Open IE. Tools--> Internet Options.
2. Click on Security tab. Select Internet then click on Custom level button.
3. Go to the User Authentication Section.
4. Select "Automatic logon with current username and password".
5. Click OK OK.

Cross-browser Javascript Datediff or Date difference function

Please visit my new Web Site

In javascript you don't get any straight cut way to calculate the date or time difference between two dates. But in our lives most of times we need to calculate the time difference between two dates. Javascript gives us a built in function named getTime() which returns the number of milliseconds since midnight of January 1, 1970. Don't be confused since the base is 1970 for all so that we can find out the milliseconds for both date. Now if we divide the millisecond by 1000 then we get second, if we divide by 60 then minute then hour then day & finally we get year by dividing 365. So lets start to calculate the date difference between two given dates. Here i will show you an imporatant example:

1. Difference between a previous date to todate.

Difference between a previous date to todate:
To do that let the previous date is June 15, 2009 & the current date is June 21, 2009 so to get the day difference the script or code should be :

<script type="text/javascript">
toDate =new Date() //June 21, 2009
var prevDay=new Date(2009, 5, 15) //June 15, 2009

//Get 1 day corresponding milliseconds
var msofaDay=1000*60*60*24

//Calculate difference btw the two dates, and convert to days
document.write("Difference between two date is: "+Math.floor((toDate.getTime()-prevDay.getTime())/(msofaDay)))

Today is the 7th day according to the above example. So if you use floor method then you will get 6 but for 7 you can use ceil method. If you want to get year difference then multiply 365 with msofaDay variable. Don't think about Leap year, you can beleive the built in methods.

Script tested for:
Internet Explorer
Mozilla Firefox
Google Chrome

Sunday, June 7, 2009

Login failed for user: The user is not associated with a trusted SQL Server connection

Please visit my new Web Site

This is your first project? Am i right? Yes almost 50%(my guess) beginner got the below message while he run his project. The message is:

Login failed for user ''. The user is not associated with a trusted SQL Server connection. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Login failed for user ''. The user is not associated with a trusted SQL Server connection.

Don't worry about this error. This is a common scenario. In this post i will try to help you. If you debug the code then in Conn.Open(); line you get this error.

In SQL Server there are two methods to authenticate a user is:
1. Windows Only Authentication
2. Windows and SQL Server Authentication or Mixed mode Authentication.

The most common reason for this error is you are using Windows Authentication & your supplied connection string is wrong. The right format of connection string for Windows Authentication is given below:

<add name="ConnectionTest" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=DBNAME;Trusted_Connection=yes;" providerName="System.Data.SqlClient"/>
*So simple. Just copy then change the connection string name & Database name.

Reasons & Solutions:
1. Check that web.config connection string is not misspelled or not any unwanted spaces.
2. If you are in local & SQL Server in remote then make sure that your domain is trusted in the SQL server domain.
3. If you change your windows password just now then logout from windows & the login again. This happend due to cache problem.
4. If your SQL Server or network is too busy then SQL Server can not authenticate you from domain controller.
5. If you are in local & SQL Server in remote & you are bound to create trusted connection then impersonation is the solution. For more details on impersonation Click Here.
6. You are trying to connect by a user like sa. User sa can not connect since the mode is Windows mode. To connect through a user you must change the mode to Mixed. See details at the bottom section to change the mode.

Here i have discussed on Windows Authentication. For Mixed mode authentication you may receive this error for wrong connection string. An idle connection string is as follows:

<add name="ConnectionTest" connectionString="Data Source=SERVERNAME;Initial Catalog=DBNAME;User Id=USERNAME;Password=xxxxx;" providerName="System.Data.SqlClient"/>
*So simple. Just copy then change the connection string name , server name, Database name, user name & password.

Reasons & Solutions:
1. Check that no unwanted space within the connection string.
2. Check user name & password.
3. Immediate password change may be reason.
4. Network congession may be the another reason.

Check Sql Server Authentication Mode:
You can check the mode easily. Run the below SQL:

EXEC master.dbo.xp_loginconfig

You will get login mode from the result like:

Change Authentication Mode:
Sql Server 2000:
You have to change the registry which is very sensitive. So becareful & backup first.
To set this key to mixed-mode, follow these steps:

1. Stop SQL Server and all related services, such as SQLAgent, from the Services control panel.
2. Click Start, click Run, type regedt32, and then click OK.
3. Find the HKEY_LOCAL_MACHINE window on the local computer.

4. Navigate to the following registry key for the default instance:

5.Navigate to the following registry key for a named instance:
HKLM\Software\Microsoft\Microsoft SQL Server\Instance Name\MSSQLServer\LoginMode

6.On the right-hand pane, find the value LoginMode and double-click it.
7. In the DWORD Editor window, set the value to 0 or 2. Also, make sure that the Hex radio button is selected.
8. Click OK.

For mixed mode set the LoginMode is 0 or 2 & for Windows Authentication set 1.

Restart SQL Server and SQL Server Agent services for this change to take effect.

For more details Click Here.

For SQL Server 2005:
In SSMS (SQL Server Management Studio), after you log in using your Windows Authentication, right click on the server and choose “Properties” and then go to the Security page and change the “Server Authentication” to be “SQL Server and Windows Authentication mode” or vice versa as shown in the image below:

Friday, June 5, 2009

DataView DataTable Creating, Adding, Modifying, Deleting, Sorting & Filtering

Please visit my new Web Site

In this tutorial i will discuss how we can manage DataTable object on the fly using C#. There were a lot of scnario where we need to dynamically create a DataTable, modify, sorting & paging. gives us the bulit in System.Data namespace to programatically manage tabular data in runtime. Note that the DataTable can be bound to any data Web control just like a DataSet or DataReader as a datasource. When binding a DataTable to a data Web control, in actuality, the default DataTable is is used as a datasource to that control like GridView, Repeater, Dropdown List etc.

Focus Area:
1. Create a DataTable
2. Modify a DataTable
3. Delete From a DataTable
4. Filtering, Sorting & Copy one DataTable to Another
5. Use Aggregate Functions
6. Create Computed Columns
7. Create XML file from a DataTable
8. DataView Sorting, Filtering, Binding
9. Bind the DataTable with GridView & Dropdown List

Create a DataTable:
To create a DataTable in runtime first instantiate the DataTable object then add columns with data types & then assign values to create rows.

DataTable oTable = new DataTable("Article");

//Add DataTable column dynamically/run time/on the fly.
oTable.Columns.Add(new DataColumn("ID", typeof(System.Int64)));
new DataColumn("Title", typeof(System.String)));
new DataColumn("Published", typeof(System.DateTime)));

//Add DataTable rows dynamically/run time/on the fly.
oTable.Rows.Add(1001, "DataTable Engineering", DateTime.Now);
"Event Calendar", DateTime.Now);
"Master Detail Data", DateTime.Now);

// Bind GridView Data from dynamically created DataTable
GridView1.DataSource = oTable;

Modify a DataTable:
You can modify any row's or column's data by specifying the row's index or column's index. Also you can access all values by iterative statement.

//By specifying column index
oTable.Rows[0][0] = 1000;

//By Specifying column name
oTable.Rows[1]["Title"] = "Event Calendar in";


(DataRow oItem in oTable.Rows)
Response.Write(oItem[0].ToString() +
" " + oItem[1].ToString() + " " + oItem[2].ToString()+"</br>");
for(int i=0;i<oTable.Rows.Count;i++)
Response.Write(oTable.Rows[i][0].ToString() +
" " + oTable.Rows[i][1].ToString() + " " + oTable.Rows[i][2].ToString() + "</br>");

Delete From a DataTable:
You can runtime delete any row from the DataTable directly. One thing you have to keep in mind that you will get "Deleted row information cannot be accessed through the row" error if try to iterate through rows without use AcceptChanges() just after deletion.


GridView1.DataSource = oTable;

Filtering, Sorting & Copy one DataTable to Another:
You can apply filter to a DataTable by Select() method. This method will take two argument. The first one is FilterExpression & 2nd one is Sort Expression. You knew the in object will take same reference when you assign an object to another. Which causes same impact on both objects. We can remove the reference by using the Clone() method. Have a look:

DataRow[] oRows = oTable.Select("ID>500", "Title DESC");

// Create oTable DataTable structure to OTable2 object
DataTable oTable2 = oTable.Clone();

// Now assign the rows data
foreach (DataRow oItem in oRows)

GridView1.DataSource = oTable2;
For an Example on Clone() method Click Here.

Use Aggregate Functions:
In this example here i will show you how you can working with Aggregate Functions in a DataTable. To do that DataTable provide us a method named Compute() which will take two parameters "String Expression", "String Filter". Within "String Expression" we can apply the Aggregate function & in "String Filter" we can apply our required filterings. You will receive Evaluate Expression error "Cannot find column [xxxx]" if you provide wrong column name in Aggregate function.

DateTime LastPublished = Convert.ToDateTime(oTable.Compute("MAX(Published)", "Published > 'Jan 01, 2005'"));
"MMM dd, yyyy"));

RowCount = Convert.ToInt32(oTable.Compute("COUNT(Title)", "Published > 'Jan 01, 2005'"));

Create Computed Columns:
You can add runtime a summary or status column in a DataTable. Which will minimize your effort dramatically. Let i want to display a column in the GridView that does this article published in this year or not. For such type cases we can use Expression property which save iur valuable time.

oTable.Columns.Add("This Year?", typeof(System.Boolean));
oTable.Columns[3].Expression =
"Published > 'Jan 01, 2010'";

GridView1.DataSource = oTable;

Create XML file from a DataTable: provide us a method named WriteXmlSchema to create runtime or on the fly XML file.

// Just one line code Convert DataTable to XML Schema
//Check the root folder for the XML file
For Security issues Click Here.

DataView Sorting, Filtering, Binding:
DataView is the top of a DataTable. From the above post i discussed a lot of issues on DataTable. Now i will show you how we can easily create a DataView, apply filtering as well as sorting. I also show you a most common usage like "Convert DataTable to DataView" & "Convert DataView to DataTable".

// Convert DataTable to DataView
DataView dView = new DataView(oTable);

// Sorting DataView
dView.Sort = " ID DESC, Title ASC";

//Filtering DataView
dView.RowFilter = "Published > 'Jan 01, 2010'";

// Convert DataView to DataTable
oTable3 = dView.Table;

// Bind DataView as a DataSource
GridView1.DataSource = dView;

Bind the DataTable with GridView & Dropdown List:
I have already discussed how to bind a DataTable or DataView to a GridView control. For DropdownList Click Here.

How to open other website URL content in my aspx page

Please visit my new Web Site

Few days ago i have a requirement that client wants to display category wise sites in his home page. To do that at first what i need? I need to display an external URL or website in my aspx page. After a short search i found an example on this by devasp. For your learning i want to share the code with you.

Add the panel into your aspx page :
<asp:panel id="mainpanel" BorderStyle="Dotted" BorderColor="orange" BorderWidth="2"
style="POSITION: absolute;top:3px;left:3px" runat="server" Width="99%"></asp:panel>

protected void Page_Load(object sender, EventArgs e)
Uri weburi = new Uri(;
StringBuilder str = new StringBuilder();
string temp = "";
HttpWebRequest webrequest = (HttpWebRequest)WebRequest.Create(weburi);
HttpWebResponse webresponse = (HttpWebResponse)webrequest.GetResponse();
StreamReader webstream = new StreamReader(webresponse.GetResponseStream(), Encoding.ASCII);
while ((temp = webstream.ReadLine()) != null)
str.Append(temp +
new System.Web.UI.LiteralControl(str.ToString()));
* Don't forget to add namespace: using System.Text;using System.Net;using System.IO;


Common Error:
1. Invalid URI: The format of the URI could not be determined.
Supply full URL like instead of

Creating XML document runtime in C#

Please visit my new Web Site

Due to the popularity of XML file most of the times we need to create XML file in runtime. In this post i will show you a simple example how we can create XML file programatically. By using this example you can also make XML file dynamically from SQL Server Database table by iterating across the rows. To make the XML on the fly first add System.Xml namespace in your project. Then create a declaration, a root element first and create elements sequentially. The example code is given below:

protected void Page_Load(object sender, EventArgs e)
XmlDocument writer = new XmlDocument();
// Create XML declaration
XmlNode declaration = writer.CreateNode(XmlNodeType.XmlDeclaration, null, null);

// Make the root element first
XmlElement root = writer.CreateElement("Article");

//Creating the <> element
XmlElement aspnet = writer.CreateElement("");

//Creating attributes of <> element
XmlAttribute id = writer.CreateAttribute("Id");
id.Value =

title = writer.CreateAttribute("Title");
title.InnerText =
"Bind Dropdown List";

visit = writer.CreateAttribute("Visit");
visit.InnerText =

modified = writer.CreateAttribute("Modified");
modified.InnerText =
"Jan 01, 2009";

// Now save/write the XML file into server root location
//Server.MapPath(".") is used to find the root path
".") + "//XMLFile.xml");
* Don't forget to add the namespace System.Xml

Ok now we found a XMLFile.xml in our application root directory. Click here to view how we can bind this XML file into GridView. So now we can programatically create a XML file & also we can use it in our application.

For permission related issues Click here.

Delete or remove duplicate rows from SQL Server table using TSQL

Please visit my new Web Site

In most of the SQL Server forum i found that they are asking to delete or eliminate duplicate rows form their table. The most common reasons are import twice, Front-end application save same data for each refresh etc. Here i want to share with you how we can remove duplicate rows data from a database table. One thing keep in mind that for different scenario you need different TSQL query or script to remove or eliminate dulicate data. Scenarios like:

1. Table has primary key(PK) but others column data duplicated.
2. Table has no primary key.

For Primary key:
If your table contains primary key but other column data is duplicated then it will more easy to remove than if the table has no primary key. Since your table has primary key then you can write a query in such a way that first group data(column or column list which is duplicated) then collect the Max or Min ID & then start deletion. For example i have the below table structure & dataset:

Look at the table, let you want to delete or eliminate data where both col & col2 were same. So the query should be:

SQL Server 2000:



* If you want to remove duplicate value for only COL then remove COL2 from group clause.
* For DateTime column, must format first like CONVERT(...) in Group By Clause.
Click Here for Format details.

SQL Server 2005:
WITH tbl_online AS (
FROM Duplicate)
DELETE FROM tbl_online WHERE Rnum > 1

WITHOUT Primary key:
For exactly same data rows just use DISTINCT Like: SELECT DISTINCT * FROM Table. Otherwise its a bit complex. Since your table contains 4 columns where you want to remove or delete duplicate rows for COL & COL2 then the solution will be varried from SQL Server 2000 to 2005.

SQL Server 2000:
Since we have no built in function so we have to use temporary table. Filter distinct columns first then merge first or top value for duplicate set & store into the temporary table. Now delete the main table & reinsert from temporary table. Before executing the below query remove ID column first.

FROM Duplicate T1

SQL Server provide us few built in function like RANK(), ROW_NUMBER() which will ease our lives:

WITH tbl_online AS (
FROM Duplicate)
DELETE FROM tbl_online WHERE Rnum > 1

Since ordering may degrade the query performence, for alternative read the below post:

Wednesday, June 3, 2009

How to write TSQL for inner/left/right/full join in update query

Please visit my new Web Site

Most of the beginner generally stuck with a problem like how to make a query to update a table by another table or from multiple table data with some conditions. In this post i will try to focus on this area how we can resolve this issue.

Let a scenario like you have an online e-commerce site where you sale some products. So when a customer place an order you need to forward this order for shipment as well as you want to update the product stock at a time. Table structure & sample data given below:

Now one of your employee from shipment section enter the shipped quantity from your application and prees the button to update. So what happen? Now we need to modify the ProductStock table based on shipeed quantity from Shipment table.

Our query should be:
UPDATE ProductStock
SET PhysicalQty=PhysicalQty-Shipment.ShippedQty
FROM ProductStock INNER JOIN Shipment
ON ProductStock.ProductID=Shipment.ProductID

After running this query the output should be:

So what we learn we can easily write a single query to update multiple rows based on another or more than one table data by using SQL Server JOIN operation.
Want To Search More?
Google Search on Internet
Subscribe RSS Subscribe RSS
Article Categories
  • Gridview
  • Javascript
  • AJAX
  • Sql server
  • XML
  • CSS
  • Free Web Site Templates
  • Free Desktop Wallpapers
  • TopOfBlogs
    Free ASP.NET articles,C#.NET,VB.NET tutorials and Examples,Ajax,SQL Server,Javascript,Jquery,XML,GridView Articles and code examples -- by Shawpnendu Bikash