Tuesday, December 30, 2008

How to remove the ¶ symbol from outlook?

Press Ctrl+Shift+8 to toggle the symbol display off.

Monday, December 15, 2008

Disable ASP Button on Submit

On the page
private void Page_Init(object sender, EventArgs e)
{
//For ASp.net button
this.btnMoveToMove.Attributes.Add("onclick", "javascript:" + btnMoveToMove.ClientID + ".disabled=true;" + btnMoveToMove.ClientID + ".value= 'please wait...';" + this.GetPostBackEventReference(btnMoveToMove));
For the image button replace the image with other image having text "wait.."
this.ibtnNext.Attributes.Add("onclick", "this.src='/newimg/btns/wait.gif';this.disabled = true;" + this.GetPostBackEventReference(this.ibtnNext));
}

Wednesday, December 10, 2008

Getting 'Webform_Postbackoptions is undefined’ errors in ASP.NET 2.0

Getting 'Webform_Postbackoptions is undefined’ errors in ASP.NET 2.0
Issue
I recently got an issue where customer ASP.NET 2.0 website on IIS and on one of the aspx pages actually we are using Validatorcontrol on this page. Browsing to that aspx page was giving client side Java script errors ‘Webform_Postbackoptions is undefined’.
In our case there is problem for the linkbutton event that is not working.
http://pocketnerd.blogspot.com/2008/01/webformpostbackoptions-is-undefined.html
Cause
1.WebResources.axd was not getting downloaded to ‘Temporary Internet Files’ folder.
2.Main Cause behind it:The main cause behind this is the porting from asp.net 1.1 to asp.net 2.0.
3.Unavailability of the .axd extention in the IIS where your website is deployed.
Resolution
Step1:Check for the .axd extention in the IIS.
1.Go to IIS.
2.Right click choose property and the Home peoperty
3.Choose configuration
4.Check for the .axd extention. If does not exist the add it.
5.By clicking on the ADD button
6.Add the dll reference from the path of your system
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll
7.limit to text box should have: GET,HEAD,POST,DEBUG
8.And uncheck the check box of the option "Verify that file exist" and click on the
OK and apply.
If your problem has not been resolved yet the follow the second step
2.Now you have to copy the .axd file content.For this step you have to first DEBUG the Java script of your page and you will get the .axd content
I just renamed my WebResource.axd file or copy its content to YourFormName.js file and place this file as part of my project(root) and included this file in those pages which are giving problem. I included this file by simple tag. script language="" src="...." tag. in head section.

After this at least your link button event will work properly, but you may still get the syntax error.This was not the permanent solution.
If Still you are facing the problem then follow next step

3.If your project is converted from asp.net 1.1 to asp.net 2.0 then, Just simply
remove old page and add new page (with same code and then remove the validator that
is used(any type) and place then again in asp.net 2.0.
and run the project, your project will work properly and link button event will fire
properly.

Friday, December 5, 2008

SQL server agent ERROR



This type of error coming when we have deleted the existing user login from the system
and new one has been created or password has been changed.
Solution: Go to control panel>Administrative Tools> services
Then in the services list, we have two sql server agent service named
1.sqlserver(SQLEXPRESS)
2.sql Server Browser
Right click and go the property and the logon tab and then update the
user name and password of the administrative account

Tuesday, September 9, 2008

SQL sever 2000 registration error




Solution:Go to Client Network Utility




Go to the alias tab and new alias that is database server name with the instance name
and apply it.Now you will be able to register the sql group.

Tuesday, August 12, 2008

How to set SMTP server on your local machine and how to test it

you can follow these links for help:
http://support.microsoft.com/kb/308161
http://support.microsoft.com/kb/304897/en-us
http://support.microsoft.com/kb/153119/en-us

Sunday, July 27, 2008

Temp table in asp.net

First create the data table and then give the definition for the column
DataTable myDataTable = new DataTable();
DataColumn myDataColumn;
DataRow myDataRow;
myDataColumn = new DataColumn();
myDataColumn.DataType = System.Type.GetType("System.Int32");
myDataColumn.ColumnName = "FileId";
myDataColumn.ReadOnly = true;
myDataColumn.Unique = true;
myDataTable.Columns.Add(myDataColumn);

myDataColumn = new DataColumn();
myDataColumn.DataType = System.Type.GetType("System.String");
myDataColumn.ColumnName = "FileName";
myDataColumn.ReadOnly = false;
myDataTable.Columns.Add(myDataColumn);

Now add the data in that table
myDataRow = myDataTable.NewRow();
myDataRow["FileId"] = i;
myDataRow["FileName"] = NameList[i].ToString();

myDataTable.Rows.Add(myDataRow);
When we delete any row then call the accept change method of the data table

Monday, July 7, 2008

asp.net code to download file in c#

if (e.CommandName == "Download")
{
string strFileName = e.CommandArgument.ToString();
string str = ConfigurationManager.AppSettings["AppPathRead"].ToString() + "/"+ strFileName;
FileInfo fileInfo = new FileInfo(str);
if (fileInfo.Exists)
{
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + fileInfo.Name);
Response.AddHeader("Content-Length", fileInfo.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.Flush();
Response.WriteFile(fileInfo.FullName);

}

Friday, May 23, 2008

unable to get the project file from web server

If you get this type of error when you open your asp.net 1.1 project from the .sln file.

Symptoms: This may be due to the any folder in your project that is started with the dot(.) eg. If you are using the svn repository.
Solution : Go to folder option and check the option donot show hidden files and folder
It will definitely work..

Tuesday, April 29, 2008

Copy Data from One Data Source to Another with SQL Query

U can simply move data from one data source to another by using the simple query,but be careful column name in both source and destination must be same in number and type.
And secondly if you execute the query again then it will append the same record again so please set the query to drop and create table.
Third one is the source and destination should be resides on same SQL server.
INSERT INTO Destination.dbo.Tb_Countries(Country_Name)
(SELECT Country_Name FROM Source.dbo.Tb_Countries)


It will copy all the data from source to destination.

Wednesday, April 9, 2008

Display special character on label in asp.net desktop application

If you want to insert some special character on the label as text like &,* ,$ then you have to set its one property false that property is UseMnemonic. Actually ByDefault it is set to true.

Tuesday, April 8, 2008

How to configure SQL Server 2005 to allow remote connections

These links may help out you..
http://support.microsoft.com/kb/914277
http://www.linglom.com/2007/08/31/enable-remote-connection-to-sql-server-2005-express/

Wednesday, February 27, 2008

Auto Log out in asp.net

write the java script code, it will work. Place this script in the Script tag
function expireSession()
{
window.location='http://localhost/Mysite/Default.aspx'
}
setTimeout('expireSession()',20000);//20 sec

Thursday, January 24, 2008

Handle default button event in Asp.Net 1.1.

Asp.Net provide the easy way to handle default button event,with asp.net you have write your own code to fire the button event on "Enter" key hit.
Here is two method to handle it.
1)Write this code on page load event.
Page.RegisterHiddenField("__EVENTTARGET", btnSearch.ClientID);

2)txtSearch.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('"+btnSearch.UniqueID+"').click();return false;}} else {return true}; ");

Here
txtSearch is the name of textbox and btnsearch is the asp button.

Tuesday, January 22, 2008

"Unable to start debugging on the web server. You do not have permission to debug the application. The URL for this project is in the Internet zone."

You may receive the error "Error while trying to run project: Unable to start debugging on the web server. You do not have permission to debug the application. The URL for this project is in the Internet zone. Click Help for more information."

This is one of the various errors that appear when you are debugging and may haunt you until you do the following fix:-

1. In the Internet Explorer, "Tools" Menu, select "Internet Options".

2. Switch to "Security" Tab.

3. Click on "Internet" (The Globe Icon. Its actually the default selected).

4. Click on "Custom Level" in the bottom.

5. Scroll down to find the "User Authentication" section.

6. Select "Automatic logon with current username and password".

7. Click "Ok" twice to exit.

This should solve the issue.

There are various reasons you get the "Unable to start debugging on the webserver". For a complete list of solutions, please check http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vsdebug.asp

Wednesday, January 16, 2008

How to maintain the position of the scrollbar on postbacks (across the entire site)

If you would like to apply this behavior to your entire site simply make a entry in your web config file
Click to see full image;






How to set the default focus to a control when the page loads

form id="frm" DefaultFocus="txtUserName" runat="server"

On way to know "How much time your function will take during execution"System.Diagnostics.Stopwatch

System.Diagnostics.Stopwatch is a replacement for what most people probably do to identify the time spent on excecuting a method.

System.Diagnostics.Stopwatch watch=new Stopwatch();
watch.Start();
//body of function
watch.Stop();
showduration.Text = "Time Spent for function body execution" + watch.Elapsed.ToString();

Speed up Visual Studio 2005

  • Make sure Visual Studio 2005 SP1 is installed.
  • Turn off animation.Go to Tools Options Environment and uncheck Animate environment tools.
  • Disable Navigation Bar.
  • If you are using ReSharper, you don't need VS2005 to update the list of methods and fields at the top of the file (CTRL-F12 does this nicely). Go to Tools Options Text Editor C# and uncheck Navigation bar.
  • Turn off Track Changes.
  • Go to Tools Options Text Editor and uncheck Track changes. This will reduce overhead and speeds up IDE response.
  • Turn off Track Active item.
  • This will turn off jumping in the explorer whenever you select different files in different projects. Go to Tools Options Projects and Solutions and uncheck Track Active Item in Solution Explorer. This will ensure that if you are moving across files in different projects, left pane will still be steady instead of jumping around.
  • Turn off AutoToolboxPopulate.
  • There is an option in VS 2005 that will cause VS to automatically populate the toolbox with any controls you compile as part of your solution. This is a useful feature when developing controls since it updates them when you build, but it can cause VS to end up taking a long time in some circumstances. To disable this option, select the Tools Options Windows Forms Designer and then set AutoToolboxPopulate to False.
  • Disable "Start Page".
    Go to Tools Options.
    In Environment Startup section, change At startup setting to Show empty environment.
  • Disable splash screen.
    Open the properties of Visual Studio 2005 shortcut.
    Add the parameter /nosplash to the target.
  • Close all unnecessary panels/tabs to prevent them from appearing when the IDE loads.

Monday, January 7, 2008

Remove HTML from your code with Regular expression.

C# code :

Regex.Replace(lContent, "<[^>]*>", "");
lContent is the string that contained HTML

Friday, January 4, 2008

How to deploy ASP.NET web application on the live server

In order to deploy Asp.Net(Version 1.1) web application to the live server follow these steps:

Requirement: 1) FTP(File Transer Protocol) details.
It contain the login credentials "Username" and password.
These are required to login on remote server.
2) Any software that establish a connection between client machine and server.
>Filezila
>ws_FTPpro (you can use any one of these)
If you do not have download from the following link:
http://www.soft32.com/download_94584.html
http://www.download.com/3000-2160_4-10771265.html
http://filezilla-project.org/
3) Your web site code that is complied.
There is some difference when we are going publish website from as.net(Version 1.1) and asp.net(Version 2.0)
In Case of ASP.NET ( Version 1.1). Follow these steps:
Step1: Rebuild your web site in the "release"mode. The benefit of this mode is that it remove all break points if there is any in your project. (Make a separate copy of your project)
Click to see full image



step2: Now delete the file having following extention:

  • .sln
  • .cs
  • .suo
  • .resx
  • csproj

Do not delete having .aspx, .asax, .webinfo, .config extenstion.
Now transfer the the final folder to the server with the help of any software that provide the interface between your client machine and server. Its interface will look like this:

Click to see full image










Left hand side will show the client machine and right side will show the server machine. Now you can simply select the folder from the client machine and transfer to the server.(For transfer you should have login credential of the server)

Note in the future if you.

  • Made changes in .cs (in any dll)file in that case you have to build your project again and replace the dll that is in the bin folder of your project after build and replace with that is on the live server.
  • Made changes in web config(or .aspx file) file then in this case you do not have any need to replace any other file simply replace web config file.

Deploy web application in ASP.NET (2.0)

In Asp.Net(2.0) is very easy you donot have any need to delete these files.(already deleted)



Simply Go Build and select the option publish Web Site and give the folder name where you want to place the final build. When the publish process is complete you can transfer to the live server.


Unable to evaluate expression because the code is optimized.........

Error: "Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack."
You get such type of exception when you are using server.transfer(); or response.redirect() on your .cs or .vb page
For knowing the symptoms and solution follow this link:
http://support.microsoft.com/kb/312629/EN-US/

Thursday, January 3, 2008

While Deploying Asp.Net Application

After developing a site either in Asp.net(ver.1.1) or Asp.net(ver.2.0), you are going to deploy it on the live server or deploy it on test server. During the deployement process some time you may face different types of error. Different types of error have different types of solutions.
These are the list of error and their respective solutions.

Case 1: Error "Server application is unavailable "
Solution : This Type of error occured because on your system two or more dot net framework is installed and your application that is deployed on the server is pointing to wrong framework .
Steps to resolve this issue:1)Open your IIS setting and go the property tag of your application and choose the ASP.NET tag as shown in the Pic.


















2) Choose the Asp.Net version(Using which your application is developed).

3)Click on apply button.
Case 2: Error. "Server Error in 'virtual directory name' Application Server cannot access application directory 'C:\virtual directory name \' the directory does not exist or is not accessible because of security settings."
Or
Access denied to c:\''Virtual directoryname\'' Failed to start monitoring file changes
Solution: This error is due to the security settings on your application folder. Follow these steps:
1).Right click the folder and go to the properties of the folder. You will see the new window like this.
Add to user give them full rights
everyone
aspnet
case 3: "The project 'project name' is on an untrusted web server. Opening this project may cause code to be executed with full trust. Do you want to continue opening this project ? If you donot trust source of this project , If you do not trust the source of this project , you should choose 'No'"


Click to see full image.

Solution :Follow this step.
1) Restart your IIS.