Tips and tricks for .NET using ASP and VB code.

Update as you type

<body style="background-color: White; color: Black;">
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <input id="Text1" runat="server" type="text" onkeyup="KeyPressed(this)" />
        <script type="text/javascript">
            function KeyPressed() {
                __doPostBack('<%= UpdatePanel1.ClientID  %>', document.getElementById("Text1").value);
            }
        </script>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <asp:Label ID="Label1" runat="server" Text="Label" BackColor="Yellow" ForeColor="#990000"></asp:Label>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    </form>
</body>

    Protected Sub UpdatePanel1_Load(sender As Object, e As System.EventArgs) Handles UpdatePanel1.Load
        Label1.Text = Request.Form("__EVENTARGUMENT")
    End Sub

No comments:

Post a Comment

Search This Blog