Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am not able to call function from javascript..on the masterPage.
Acctually i have a button and textbox.I am doing validation on each page that are integrated with master page but i am not able to do this..

I am try as like this....

On Masster page..
XML
<script type="text/javascript">
function ValidateTextBox()
{
    var Text = document.getElementById('<%=txtkey.ClientID %>');

    if(Text.value == "")
    {
        alert('Please enter at least one key skill..');
        return false;
    }

}
</script>



and on button also in Master Page-----

XML
<form>
<div>
<body>

<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Images/search_btn.png" onclick="ImageButton1_Click" CausesValidation="False" OnClientClick="return ValidateTextBox()" />
</form>

</body>
Posted
Updated 29-Aug-12 0:48am
v3

1 solution

Quote:
<script type="text/javascript">
function ValidateTextBox()
{
var Text = document.getElementById('<%=txtkey.ClientID %>');

if(Text.value == "")
{
alert('Please enter at least one key skill..');
return false;
}else{
return true;
}
}
</script>



Quote:
<form>

<body>

<asp:imagebutton id="ImageButton1" runat="server" imageurl="~/Images/search_btn.png" onclick="ImageButton1_Click" causesvalidation="False" onclientclick="return ValidateTextBox();"/>
</form>

</body>


Try this!
Hope it will Help!.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900