How to use javascript code in master page of Asp.net ?


<%@ Page Language=”C#” MasterPageFile=”~/MasterPage.master” AutoEventWireup=”true” CodeFile=”JavaScript.aspx.cs” Inherits=”Default3″ Title=”Untitled Page” %>

<asp:Content ID=”Content1″ ContentPlaceHolderID=”ContentPlaceHolder1″ Runat=”Server”>
<script language=”javascript”>
function checkno(as)
{

if(as==”TextBox1″)
{
var x=document.getElementById(‘<%=TextBox1.ClientID%>’).value;

document.getElementById(‘<%=TextBox2.ClientID%>’).value=x;
}

}

</script>
<asp:TextBox ID=”TextBox1″ onkeyup=”checkno(‘TextBox1’)” runat=”server”></asp:TextBox><br />
<asp:TextBox ID=”TextBox2″ runat=”server”></asp:TextBox>
<br />

</asp:Content>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: