Do you see what I am doing wrong here? If I uncomment the alert I
don't see the alert, so there is a problem in the javascript setting
the hidden value. Below is the html and the code behind. Thanks
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="Test16.aspx.vb" Inherits="wave.Test16"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Test16</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="
http://schemas.microsoft.com/intellisense/ie5">
<script>
function aaa()
{
Hidden1.value = document.selection();
//alert("hi");
}
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<asp:Button id="Button1" runat="server" Text="Button"></asp:Button>
<P></P>
<asp:Label id="Label1" runat="server">Label1</asp:Label>
<P></P>
<input type="hidden" id="Hidden1" runat="server">
</form>
</body>
</HTML>
Public Class Test16
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
End Sub
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents Hidden1 As
System.Web.UI.HtmlControls.HtmlInputHidden
'NOTE: The following placeholder declaration is required by the Web
Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Button1.Attributes.Add("onclick", "aaa()")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Label1.Text = Hidden1.Value
End Sub
End Class