To resolve this issue what you have to do is right click on the class file and then select the properties.
Tuesday, May 20, 2014
Not able to access classes in the App_Code folder in Visual Studio 2013
To resolve this issue what you have to do is right click on the class file and then select the properties.
Wednesday, April 9, 2014
Synchronize local MS SQL database to SQL Azure
SQL Azure allows you to configure this synchronization automatically and will allow you to set the frequency of data synchronization as well.
Ok, as usual we will go through the complete procedure step by step.
First we will create a database in our local database system and insert few data in the table.
Tuesday, April 8, 2014
Deploy ASP.NET web application in cloud with SQL Azure Connectivity
Lets go through the complete procedure you have to follow to do the web application deployment with SQL Azure.
Thursday, April 3, 2014
Ajax MutuallyExclusiveCheckBoxExtender in ASP.NET
It required hardly few lines of codes and it is very easy and simple to understand. In this article I am taking you through this interesting control which you can use in your application whenever you require Mutually Exclusive CheckBox.
First we will design a sample webpage by adding few check boxes. Your sample page design may look like below,
Saturday, March 29, 2014
Load balancing using Windows Azure Virtual Machine
Let’s go through step by step procedure.
Tuesday, March 25, 2014
How to Deploy ASP.NET web application in Windows Azure Virtual Machine
If you are not sure how to create Virtual Machine in Windows Azure you may read my article How to create Virtual Machine in Windows Azure
In this article I am explaining the steps you have to follow after creating the Virtual machine.
As usual first you have to login to the Virtual Machine by login to your Windows Azure account. You may open your Windows Azure account by opening Windows Azure Login Page
Tuesday, March 18, 2014
How to create Virtual Machine in Windows Azure
Let’s go through step by step procedure, first we will login to Windows Azure by opening Windows Azure Login Page
Monday, March 17, 2014
How to Create Database in SQL Azure
First we will connect to the Windows Azure. You should have a windows Azure account in order to login to Azure site. Here is the URL to login to Windows Azure.
Once you login to your account you will find below page.
Tuesday, March 11, 2014
REBOOT Bangalore - CloudCamp
Reboot is the first ever full day community driven multi city, multi-track event happening in Namma Bengaluru.
Reboot will witness great line up of speakers from different parts of India who are great community leaders, helping grow and shape the technical communities in their respective cities. Many of them are the Microsoft Most Valuable Professionals or Microsoft Employees.
Below are sessions planned for you with free meal @ ITC HOTEL WINDSOR SHERATON & TOWERS (Windsor Manor)
Join us with our MVPs as they discuss how you can build and scale in the cloud.
Thursday, March 6, 2014
How to write text on an Image using C#
Using this code you can write any text in an image at any place, using any color and format of the text.
First we will look at the form design. The form looks like below,
Wednesday, February 26, 2014
How to find Operating System version using SQL query
There are some cases you wanted to check the Operating system installed on your SQL server. You may not have remote login access to the server where SQL server is installed in that case it will be difficult to know what is the operating system installed on your server where SQL database is installed.
In this article I am going to explain you the simple query which you can run in your SQL server Query analyzer and it will show you the Operating System version installed on your database server.
SQL Server by default provides you an inbuilt table with all the details of the operating system installed on your database server. sys.dm_os_windows_info is the table you may query in this regard.
Your final query will be,
SELECT windows_release, windows_service_pack_level, windows_sku, os_language_versionFROM sys.dm_os_windows_infoAnd the output of the above query will be,
| windows_release | windows_service_pack_level | windows_sku | os_language_version |
| 6.1 | Service Pack 1 | 10 | 1033 |
In the above result you can see that windows release is 6.1 means Windows Server 2008 R2 in my case. It can be Windows 7 if your database is not installed on the server.
You can find all the operating system version number in below chart.
| Operating system | Version number |
| Windows 8.1 | 6.3 |
| Windows Server 2012 R2 | 6.3 |
| Windows 8 | 6.2 |
| Windows Server 2012 | 6.2 |
| Windows 7 | 6.1 |
| Windows Server 2008 R2 | 6.1 |
| Windows Server 2008 | 6 |
| Windows Vista | 6 |
| Windows Server 2003 R2 | 5.2 |
| Windows Server 2003 | 5.2 |
| Windows XP 64-Bit Edition | 5.2 |
| Windows XP | 5.1 |
| Windows 2000 | 5 |
Saturday, February 15, 2014
How to use Timer / Stop Watch using JavaScript
In this article I am going to explain timer/stop watch function using JavaScript. In many situations we may get requirement to show the timer in your application. This article will help you to show the timer using JavaScript in a webpage.
To implement the timer first we will write JavaScript function and save it as .Timer.js.
var milliSec = 0; var seconds = 0; var minutes = 0; function startTimer() { var timerVal = document.getElementById('lblTimer'); timerVal.value = minutes + ":" + seconds + ":" + milliSec; go=setTimeout("startTimer()",1); milliSec++; if(milliSec==100) { milliSec=0; seconds++; } if(seconds==60) { seconds=0; minutes++; } } function stopTimer() { clearTimeout(go) }
Below is the HTML code to design the webpage. Here you can see that startTimer() and stopTimer fucntion is called on click of the button. Also you can see that I have referred the Timer.js Javascript file which is saved in the root folder.
<html> <head> <title>Timer Using JavaScript</title> <script type="text/javascript" src="Timer.js"></script> </head> <body> <form> <table> <tr> <td colspan="3" ><input id="lblTimer" type="text" name="displayTime" STYLE="color: red; border:0px; font-family: Verdana; font-weight: bold; font-size: 25px; " size="10" maxlength="30 value="00:00:00" /></td> </tr> <tr> <td> <input type="button" value="Start Timer" onclick="startTimer()"/> <input type="button" value="Stop Timer" onclick="stopTimer()"/> </td> </tr> </table> </form> </body> </html>
The output looks like below.
Monday, February 3, 2014
How to list all sub directories in a directory using C#
Do you want to display all directories in the specified directory using C#? Read this article to know how to list the subdirectories using .NET
Here first I added a Label, a TextBox, a Button and a ListBox to the form. Textbox is used to enter the folder path. Once you click on on the button sub directories will be shown in the list box.
We will see the page design first.
Below is the source code for the page design.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ListDir.aspx.cs" Inherits="Blog.ListDir" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <style type="text/css"> .auto-style1 { width: 100%; } .auto-style2 { width: 156px; } .auto-style3 { width: 156px; height: 26px; } .auto-style4 { height: 26px; } </style> </head> <body> <form id="form1" runat="server"> <div> </div> <table class="auto-style1"> <tr> <td class="auto-style3"> <asp:Label ID="lblDir" runat="server" Text="Enter the Root Directory"></asp:Label> </td> <td class="auto-style4"> <asp:TextBox ID="txtPath" runat="server"></asp:TextBox> </td> <td class="auto-style4"></td> </tr> <tr> <td class="auto-style2"> </td> <td> <asp:Button ID="btnDisplay" runat="server" Text="Show All Sub Directories" OnClick="btnDisplay_Click" /> </td> <td> </td> </tr> <tr> <td class="auto-style2"> </td> <td> <asp:ListBox ID="lstDir" runat="server" Height="124px" Rows="5" Width="154px"></asp:ListBox> </td> <td> </td> </tr> </table> </form> </body> </html>
On Button Click event write the following code.
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.IO; namespace Blog { public partial class ListDir : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { lstDir.Visible = false; } protected void btnDisplay_Click(object sender, EventArgs e) { lstDir.Visible = true; lstDir.Items.Clear(); string strFolderPath = txtPath.Text; DirectoryInfo dirInfo = new DirectoryInfo(strFolderPath); if (dirInfo.Exists) { DirectoryInfo[] dirSubDir = dirInfo.GetDirectories(); for (int i = 0; i < dirSubDir.Length; i++) { lstDir.Items.Add(dirSubDir[i].ToString()); } } else { lstDir.Items.Add("No such directory..."); } } } }
And the final output will be like below,
Wednesday, January 29, 2014
How to share folders using C# .NET
There are many cases you may have to share the data with other computer/Users. If anybody have more than one computer and want to transfer some file over it you have to share the folder so that other users will be able to access the files inside the shared folder. Read this article to learn how to share a folder over your local network using ASP.NET.
For implementing this concept I have created one webpage like below.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ShareFolder.aspx.cs" Inherits="Blog.ShareFolder" %><!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {width: 100%;
}
.auto-style2 {width: 169px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<table class="auto-style1">
<tr>
<td class="auto-style2">
<asp:Label ID="Label1" runat="server" Text="Share Folder Path"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtPath" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label2" runat="server" Text="Share Folder Name"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtName" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label3" runat="server" Text="Share Folder Description"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtDesc" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td>
<asp:Button ID="btnShare" runat="server" OnClick="btnShare_Click" Text="Share Folder" />
</td>
</tr>
</table>
<div>
<asp:Label ID="lblResult" runat="server"></asp:Label>
</div>
</form>
</body>
</html>
Here I am using three TextBox.
1. txtPath - To enter complete folder path which you want to share
2. txtName - Folder name to be displayed for shared folder
3. txtDesc - Description for the shared folder
First we need to create a directory and subdirectories in the specified path given in the first TextBox.
Directory.CreateDirectory(strSharePath);
Next step is to create a management class. For that we need to add a reference System.Management. You can refer below screen print to know how to add the reference.
Then create a Shared folder with the name and description what we got through TextBox.
Here is the complete code you may use for this purpose:
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.IO;using System.Management;namespace Blog{public partial class ShareFolder : System.Web.UI.Page
{protected void Page_Load(object sender, EventArgs e)
{}
protected void btnShare_Click(object sender, EventArgs e)
{ string strSharePath = txtPath.Text.ToString(); string strShareName = txtName.Text.ToString(); string strShareDesc = txtDesc.Text.ToString(); try {Directory.CreateDirectory(strSharePath);
ManagementClass oManagementClass = new ManagementClass("Win32_Share");
ManagementBaseObject inputParameters = oManagementClass.GetMethodParameters("Create");ManagementBaseObject outputParameters;
inputParameters["Description"] = strShareDesc; inputParameters["Name"] = strShareName; inputParameters["Path"] = strSharePath;inputParameters["Type"] = 0x0;//disk drive
inputParameters["MaximumAllowed"] = null;
inputParameters["Access"] = null;//Make Everyone has full control access
inputParameters["Password"] = null;
outputParameters = oManagementClass.InvokeMethod("Create", inputParameters, null);//// Invoke the method on the ManagementClass object
if ((uint)(outputParameters.Properties["ReturnValue"].Value) != 0)
{throw new Exception("There is a problem while sharing the directory.");
}
else { lblResult.Text = "Share Folder has been created with the name :" + strShareName;}
}
catch(Exception ex) {lblResult.Text = ex.Message.ToString();
}
}
}
}
You have many more options for the Create method of the Win32_Share class, you can read all this option from MSDN article.
After running the code, you will be seeing the interface like below. You can also see the data which you need to enter in below screen print.
Once you execute the code successfully your folder will be shared like below,
Thursday, January 23, 2014
Ajax Animation Extender control
Are you thinking of decorating your website with some animation? Then there is one simple and useful control in AjaxControlToolkit named Animation extender which help you to give excellent animation to your pages.
You can apply animations to target control when some events likes, OnLoad, OnClick, OnMouseOver, or OnMouseOut raised. Here I am trying to explain how this Ajax Animation Control will work.
STEP : 1 Create a new webform
Create a new webform in ASP.NET. Drag and drop ToolScriptManager, Panel and a Animation Extender control.
STEP 2 : Create a CSS class to the panel
Here I am using a panel for animation which is the target control. First I created a style sheet for the panel.
<style>
.animationPanel
{position : absolute;
height : 250px;
width: 300px;
top: 100px;
left: 400px;
border-width: 2px;
border-color:red;
border-style:solid;
}
</style>
STEP 3 : Write animation properties
First I set animation property for the text inside the panel and then I set the animation for panel. Here I am doing the animation sequentially. I wrote the code on click event of the panel.
So the entire .aspx page looks like below.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Ajaxanimation.aspx.cs" Inherits="Blog.Ajaxanimation" %><%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %><!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>AjaxAnimation</title>
<style>
.animationPanel
{position : absolute;
height : 250px;
width: 300px;
top: 100px;
left: 400px;
border-width: 2px;
border-color:red;
border-style:solid;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<br />
<asp:Panel ID="ajaxPanel" runat="server" CssClass="animationPanel">
Click me!!! I will move...<br><br><br>
<div id ="info">
Thanks for vising asheej.blogspot.com<br>
You are reading the article related to AJAX animation extender
</div>
</asp:Panel>
<asp:AnimationExtender ID="AnimationExtender1" runat="server" TargetControlID="ajaxPanel">
<Animations>
<OnClick>
<Sequence><%-- Sequance is used to do the animation sequantially --%>
<%-- Below code will help you to move the Panel --%>
<Parallel AnimationTarget="info" Duration=".2">
<Color PropertyKey="color"
StartValue="#0000CD" EndValue="#FF0000" />
<Color PropertyKey="borderColor"
StartValue="#0000CD" EndValue="#FF0000" />
</Parallel>
<Parallel AnimationTarget="info" Duration=".2">
<Color PropertyKey="color"
StartValue="#FF0000" EndValue="#666666" />
<Color PropertyKey="borderColor"
StartValue="#FF0000" EndValue="#666666" />
</Parallel>
<Parallel AnimationTarget="flyout" Duration=".1" Fps="30">
<Move Horizontal="200" Vertical="-75" />
<Resize Height="300" Width="300" />
<Color AnimationTarget="info" PropertyKey="backgroundColor"
StartValue="#ADFF2F" EndValue="#00FFFF" />
</Parallel>
</Sequence>
</OnClick>
</Animations>
</asp:AnimationExtender>
</div>
</form>
</body>
</html>
STEP 4 : Build the solution and run the application
After running the code the result should be looks like this:
AnimationExtender Control properties:
- TargetControlID : It is the ID of the control to which animation occurs.
- OnLoad : Set the animation when the page is loaded
- OnClick : Set the animation when the target control is clicked
- OnMouseOver : Set the animation when the mouse moves over the target control
- OnMouseOut : Set the animation when the mouse moves out the target control
- OnHoverOver : Set the animation when the mouse moves over the target control. But it stop the OnHoverOut animation before it plays.
- OnHoverOut : Set the animation when the mouse moves out the target control. But it stop the OnHoverOver animation before it plays.