AzaraT
09-25-2009, 04:42 PM
Hi there.
I want to call a javascript fuction from the aspx.cs file. My code is as follows:
.aspx
<body>
<script>
fuction test ()
{
// code goes here
}
</script>
<form id="form1" runat="server">
<div style="height: 318px">
<asp:TextBox ID="textboxlogin" runat="server"></asp:TextBox>
<br />
<br />
<asp:TextBox ID="textboxpassword" runat="server" TextMode="Password"></asp:TextBox>
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
<br />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
</body>
What I want to, is when the asp:button is clicked that fuction is called. I thought that the way to do it was to call the javascript fuction from the Button1_Click in the aspx.cs file but how do I do this?
I also tried doing
onclick="Button1_Click && test();"
but that didn't work. I'm using C#.
Any suggestions?
Thanks
Jacob
I want to call a javascript fuction from the aspx.cs file. My code is as follows:
.aspx
<body>
<script>
fuction test ()
{
// code goes here
}
</script>
<form id="form1" runat="server">
<div style="height: 318px">
<asp:TextBox ID="textboxlogin" runat="server"></asp:TextBox>
<br />
<br />
<asp:TextBox ID="textboxpassword" runat="server" TextMode="Password"></asp:TextBox>
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
<br />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
</body>
What I want to, is when the asp:button is clicked that fuction is called. I thought that the way to do it was to call the javascript fuction from the Button1_Click in the aspx.cs file but how do I do this?
I also tried doing
onclick="Button1_Click && test();"
but that didn't work. I'm using C#.
Any suggestions?
Thanks
Jacob