I have one web page on masterPage i have 2 links which redirects user to another page...
For example:
Link 1:Customer Detail-this page contain some textbox to save data into the database such as customer id, customer name, customer address,customer contact..

Link 2:Employee Details-this page contain some textbox to save data into the database such as Employee id, Employee name, Employee address,Employee contact..

Suppose user is currently on Page 2 that is Link 2.... And He have entered Some text in all 4 textBox... and forgets to save data... and directly click on Pafe 1 that is Link 1...
Then He should get error message saying "the data is not saved.. this will take u to another page and your entered data will be lost.."

MasterPage code:

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
    <form id="form1" runat="server">
    function confirm()
if (confirm ==true)


return false;


        &nbsp;<table border="0" cellpadding="0" cellspacing="0" style="width: 100%; height: 100%">
                <td colspan="2" style="height: 200px">
                <td style="width: 200px">
                    <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
                    <asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Button" />
                    <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
                <td colspan="2" style="height: 200px">

And on click on those link have this code...

protected void Button1_Click(object sender, EventArgs e)
        Button1.Attributes.Add("onclick", "return confirm('Are you sure you proceed?');");

But i want to show message box only when the textbox are not blank....