开发者

onkeyup client event issues on telerik input controls

开发者 https://www.devze.com 2023-03-21 04:53 出处:网络
i want to copy a textbox text property to another when typing (should be exactly the same)... so please see the below codes (copy and paste and Test them) :

i want to copy a textbox text property to another when typing (should be exactly the same)...

so please see the below codes (copy and paste and Test them) :

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="keyup.Default" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>开发者_StackOverflow中文版;</title>
    <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
    <style type="text/css">
        fieldset
        {
            width:300px;
        }
        legend
        {
            color:Blue;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <div>
        <fieldset>
            <legend>keyup</legend>
            <asp:TextBox ID="TextBox1" runat="server" onkeyup="onkeyup_TextBox1();"></asp:TextBox>
            <br />
            <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
        </fieldset>
        <br />
        <br />
        <fieldset>
            <legend>keydown</legend>
            <asp:TextBox ID="TextBox3" runat="server" onkeydown="onkeydown_TextBox3();"></asp:TextBox>
            <br />
            <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
        </fieldset>
        <br />
        <br />
        <fieldset>
            <legend>keypress</legend>
            <asp:TextBox ID="TextBox5" runat="server" onkeypress="onkeypress_TextBox5();"></asp:TextBox>
            <br />
            <asp:TextBox ID="TextBox6" runat="server"></asp:TextBox>
        </fieldset>
        <br />
        <br />
        <fieldset>
            <legend>Telerik - keyup</legend>
            <telerik:RadNumericTextBox ID="RadNumericTextBox1" runat="server" DataType="System.Int32"
                onkeyup="onkeyup_RadNumericTextBox1();">
                <NumberFormat DecimalDigits="0" />
            </telerik:RadNumericTextBox>
            <br />
            <telerik:RadNumericTextBox ID="RadNumericTextBox2" runat="server" 
                DataType="System.Int32" Culture="fa-IR" Width="125px">
                <NumberFormat DecimalDigits="0" />
            </telerik:RadNumericTextBox>
        </fieldset>
    </div>
        <script type="text/javascript">
            function onkeyup_TextBox1() {
                $('#TextBox2').val($('#TextBox1').val());
            }
            function onkeydown_TextBox3() {
                $('#TextBox4').val($('#TextBox3').val());
            }
            function onkeypress_TextBox5() {
                $('#TextBox6').val($('#TextBox5').val());
            }
            function onkeyup_RadNumericTextBox1() {
                var RadNumericTextBox1 = $find("<%= RadNumericTextBox1.ClientID %>");
                var RadNumericTextBox2 = $find("<%= RadNumericTextBox2.ClientID %>");

                RadNumericTextBox2.set_value(RadNumericTextBox1.get_value());
            }
    </script>
    </form>
</body>
</html>  

EDIT

for my purpose onkeyup event on regular asp.net textbox controls is ok... but it does n't work sometimes in telerik input controls!(there is no problem about onkeyup syntax , just when typing in first text box the other one have 1 character less , why ?)

which event should i use for telerik input controls for doing this job?

thanks in advance

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号