How to add watermark on a textbox by using javascript?

There are 3 ways to add watermark functionality on a textbox by using javascript. <asp:TextBox ID=”TextBox1″ Text=”Search” runat=”server” onfocus=”javascript:if(this.value==’Search’){this.value=’’;}” onblur=”javascript:if(this.value==’’) {this.value=’Search’;}” /> Or <script language=”javascript” type=”text/javascript”> function WaterMark(txtValue, txtWaterMark) { if (txtValue.value == txtWaterMark) txtValue.value = ”; else txtValue.value = txtWaterMark; } </script> <asp:TextBox ID=”TextBox1″ Text=”Search” runat=”server” onblur=”WaterMark(this,’Search’);” onfocus=”WaterMark(this,’Search’);” />… Continue reading

ASP.NET Routing not working on IIS 7.0

I ran into a nasty little problem today when deploying an application using ASP.NET 4.0 Routing to my live server. The application and its Routing were working just fine on my dev machine (Windows 7 and IIS 7.5), but when I deployed (Windows 2008 R1 and IIS 7.0) Routing would… Continue reading

How to disable back button of browser?

By using java script it can be done <script language=”JavaScript”>javascript:window.history.forward(1);</script> Or <A HREF=”PageName.htm” onclick=”javascript:location.replace(this.href); event.returnValue=false; “>No back button when you do this.</A> Or <html><head><title>Back Button Demo: Page One</title> <script> function backButtonOverride() {  setTimeout(“backButtonOverrideBody()”, 1);  } function backButtonOverrideBody() { try { history.forward(); } catch (e) { } setTimeout(“backButtonOverrideBody()”, 500); } </script></head><body… Continue reading

Web Developer Framework 4.0 Sample Questions – 2

Question: You are implementing an ASP.NET Web site that will be accessed by an international audience. The site contains global and local resources for display elements that must be translated into the language that is selected by the user. You need to ensure that the Label control named lblCompany displays… Continue reading

Web Developer Framework 4.0 Sample Questions – 1

Question: You are implementing an ASP.NET application that uses data-bound GridView controls in multiple pages. You add JavaScript code to periodically update specific types of data items in these GridView controls. You need to ensure that the JavaScript code can locate the HTML elements created for each row in these… Continue reading