
Untitled
By: a guest on
Jun 30th, 2012 | syntax:
None | size: 1.64 KB | hits: 10 | expires: Never
Jquery and webserver controls
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TestForm.aspx.cs" Inherits="TestForm" %>
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="http://code.jquery.com/jquery-1.5.js" type="text/jscript"></script>
</head>
<body>
<p>Hello</p>
<a href="#">Click to hide me too</a>
<p>Here is another paragraph</p>
<input id="HTMLButton" type="button" value="HTML Button" />
<script type="text/jscript" >
//Desired Behavior. The Command button outside Form Attribute works are desired.
$("input").click(function () {
$("#NameText").toggle()
});
$("#<%=WebCtrlJScript.ClientID%>").click(function () {
alert("Button btnToggleDiv from Name Clicked");
$("#NameText").toggle();
});
//This is simple HTML button inside Form Element.
$("#HTMLInsideForm").click(function () {
alert("Button HTMLInsideForm Clicked");
$("#NameText").toggle()
});
</script>
<script type="text/javascript">
function NameText() {
alert("WebCtrlOnClientClick Clicked");
$("#NameText").hide();
this.blur();
}
</script>
<form id="Form1" runat="server">
<div id="NameText">
<table>
<tr>
<td>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</td>
</tr>
</table>
</div>
<div>
<asp:Button ID="WebCtrlOnClientClick" runat="server" Text=".Net Button" OnClientClick="NameText()"/>
<asp:Button ID="WebCtrlJScript" runat="server" Text="JScript Button"/>
<input id="HTMLInsideForm" type="button" value="HTML Button(Inside Div)" />
</div>
</form>
</body>
</html>