Sunday, February 28, 2010

Microsoft Security Essentials - Free Antivirus for Home PC

Now you can secure your Home PC by free anitvirus provided by none other than Microsoft itself. It guards your PC against Viruses, Spyware, and other malicious software.



Learn and download Microsoft Security Essentials

Friday, February 26, 2010

Disable post back on enter key in TextBox

By default when you hit enter while cursor is in the TextBox, the first button on the page event gets fired.


I have added a TextBox and a Button in the aspx page like below


<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />


 


And the below code in the code behind




protected void Button1_Click(object sender, EventArgs e)
{
   Response.Write(
"Button1");
}


 


Now run the application and hit enter key while cursor is in TextBox, you will notice that "Button1" printed on the page.


To avoid executiong of code behind of the button put


OnKeyDown = "return (event.keyCode!=13);"


in the TextBox like below


<asp:TextBox ID="TextBox1" OnKeyDown = "return (event.keyCode!=13);" runat="server"></asp:TextBox>

 


Now run the application again and hit enter key, this time Button Click even won't fire.


Happy Coding :)

Tuesday, February 23, 2010

VS2010 Express Edition

VS2010 Express Beta 2 has been launched. It is set of free tools which includes

Microsoft Visual Bascic 2010 Express

Microsoft Visual Web Developer 2010

Microsoft Visual C# 2010 Express

Microsoft® Visual C++ 2010 Express

I have tried VS2008, i found it pretty good as you can do most of the basic development in express edition. Express edition is just to get hands on to the software. This is very useful for students or for those who wants to learn the technology. It is not for advanced and professional development as features are limited for any advanced development.

Download all these tools Here

Sunday, February 21, 2010

.NET 4.0 Beta Exams - Absolutely Free

.NET 4.0 exams are on its way and will be available between March 31, 2010 to April 20, 2010 Beta Exams

The exams which will be availabe are:

70-511 TS: Windows Applications Development with Microsoft® .NET Framework 4
70-513 TS: Windows Communication Foundation Development with Microsoft® .NET Framework 4
70-515 TS: Web Applications Development with Microsoft® .NET Framework 4
70-516 TS: Accessing Data with Microsoft® .NET Framework 4
70-519 Pro: Designing and Developing Web Applications using Microsoft® .NET Framework 4

70-518 Pro: Designing and Developing Windows® Applications using Microsoft .NET Framework 4 will not be available in this time frame but should be available in the April time frame.

Question: How to participate in beta exams?
Answer : Participating in Beta Exams

Passing the beta exam

You usually receive your exam score by the time the final version of the exam becomes available—this may be 16 to 20 weeks after you take the exam. This timeframe reflects the comprehensive process used to evaluate the beta exam results. If you pass the beta exam, you earn credit for that exam and any resulting certification. You do not need to retake the exam in its final version if you pass the beta version.
If you do not pass the beta exam, you cannot retake it. You must wait to take the exam in its final version at the regular cost of US$125. There are a limited number of seats available for beta exams, and it is important to allow a variety of candidates to participate. You should not use a beta exam as a practice test.
If you believe your score should be available and it is not, first check if Prometric has posted it. If not, contact Prometric. If Prometric has posted a score, but you do not see the score on your Microsoft transcript, contact your Microsoft Regional Service Center.

Best of Luck :)

Friday, February 19, 2010

ValidatorCallOutExtender in TextBox in Gridview

Place a gridview with two itemtemplate.
One template to keep TextBox, RequiredFieldValidator and ValidatorCalloutExtender.
Second template will contain Button. Copy and paste the below code on the aspx page





<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" OnRowDataBound="GridView1_RowDataBound">


<Columns>


<asp:TemplateField>


<ItemTemplate>


<asp:TextBox runat="server" ID="MyTextBox"


BorderStyle="solid" BorderWidth="1px" BorderColor="#a9a9a9" />


<asp:RequiredFieldValidator runat="server" ID="MyReq"


ControlToValidate="MyTextBox" Display="None"


ErrorMessage="<b>Required Field Missing</b><br />A name is required." />


<ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="NReqE1"


TargetControlID="MyReq"


HighlightCssClass="validatorCalloutHighlight" />


</ItemTemplate>


</asp:TemplateField>


<asp:TemplateField>


<ItemTemplate>


<asp:Button runat="server" ID="btn" Text="Testing"


BorderStyle="solid" BorderWidth="1px" BorderColor="#a9a9a9"/>


</ItemTemplate>


</asp:TemplateField>


<asp:BoundField DataField="lastName" HeaderText="Last Name" />


</Columns>


</asp:GridView>


 




Now we need to bind TextBox, RequiredFieldValidator and Button with validation group. ValidationGroup name should be unique for each pair of TextBox and Button. To give unique name to ValidationGroup of each pair of TextBox and Button, we need to bind the TextBox and Button GridView1_RowDataBound. Refer below code.







protected void GridView1_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)


{


   if (e.Row.RowType == DataControlRowType.DataRow)


   {


      TextBox tbx = (TextBox)e.Row.FindControl("MyTextBox");


      RequiredFieldValidator rfv = (RequiredFieldValidator)   


      e.Row.FindControl("MyReq");


      Button btn = (Button)e.Row.FindControl("btn");


      string validationGroupText = "ValidationTest" + (e.Row.DataItemIndex + 1).ToString();


      tbx.ValidationGroup = validationGroupText;


      rfv.ValidationGroup = validationGroupText;


      btn.ValidationGroup = validationGroupText;


   }


}


 




Compile and run the application.

Happy Coding :)

Tuesday, February 16, 2010

VS2010 First Look Features

The first change you will notice when you open VS2010 web project is the solution explorer with addtional folders and files.

You will notice Account , Scripts and Styles folder.

Accont folder is consisting of ChangePassword.aspx, ChangePasswordSuccess.aspx, Login.aspx, Register.aspx and web.config files.

Scripts folder is consisting of jquery-1.3.2-vsdoc.js, jquery-1.3.2.js, jquery-1.3.2.min.js

Styles folder is consisting of Site.css.


You will also notice that About.aspx part of the project.

Now, Master page is added by default. You won't see form tag in the page as master page has been added by default.



Now it is easy to find out where all declared variable has been used. Select the variable and all the variables in that scope will be selected.



Now intellisense is more smarter, it searches the occurrence of typed character rather than searching for matching characters from the begining.

In the below screenshot, the typed letter is "in" but you can see TabIndex also along with Init as in occurs in TabIndex also.



Use it to feel the all new exciting features of VS2010.

Sunday, February 7, 2010

Allowing only alphabets or numbers in the textbox

Place two text boxes on the page one to validate numbers and other to validate alphabets.

<asp:TextBox id="txtNumber" runat="server" onkeypress= "validateNumber()"/>

<asp:TextBox id="txtAlpha" runat="server" onkeypress= "validateAlphabet()"/>

Place the below javascripts to validate number and alphabet, first javascript will allow to enter only 0 to 9 and second javascript will allow to enter only a-z and A-Z

<script language="javascript" type="text/javascript">

function validateNumber()
{
if(!(event.keyCode >= 45 && event.keyCode <= 57))
{
event.returnValue=false;
}
}

function validateAlphabet()
{
if(!(event.keyCode >= 65 && event.keyCode <= 90) && !(event.keyCode >= 97 && event.keyCode <= 122))
{
event.returnValue=false;
}
}



Happy Coding!

Friday, February 5, 2010

Few exciting feature of Bing

This is my first non technical blog as i couldn't resist myself to blog about the exciting feature of bing.

The history feature of bing shows 24 last searched kewwords.



The small arrow button on right bottom of the bing page provides the way to view previous days images.



This wonderful feature gives the way to see the price on search page itself.



Quick tab feature helps the end user to quickly get the related articles on the search page itself.



This feature enables to see the related video of searched items on the page itself without leaving search page.



This feature enables you to get the recipes of the searched items.



Click on recipes of chicken, you will get the below image which is truly exciting.

Site Meter