一旦员工在eid文本框中输入其员工ID,我想在相应的文本框字段中显示员工的详细信息。 [英] I want to show the details of the employee in respective textbox field as soon as employee enters his Employee id in a eid textbox.

查看:149
本文介绍了一旦员工在eid文本框中输入其员工ID,我想在相应的文本框字段中显示员工的详细信息。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请告诉我我能为此做些什么......我必须在页面加载时默认设置第一个员工ID文本框。

plz tell me what i can do for this....and i have to set by default focus on first employee id textbox when page get load.

推荐答案

在服务器端使用textchange事件并获取该员工ID的数据并填写它。对于员工ID的文本框,保持autopostback为真。



use textchange event on the server side and get data for that employee id and fill it. keep autopostback true for the textbox of employee id.

<asp:textbox id="txteid" runat="server" autopostback="true" ontextchange="txteid_ontextchange" xmlns:asp="#unknown"></asp:textbox>







protected void txteid_ontextchange (object sender, EventArgs e)
{
if(txteid.text!="")
{
string Eid = txteid.text
//your logic goes here to get data based on eID;
}

}


试试这个



Try this

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <script type="text/javascript">
        var searchid = function () {
            __doPostBack('<%= TextBox1.ClientID %>', '');
        }
    </script>
</head>
<body>
    <form id="frm" runat="server">
    <asp:TextBox ID="TextBox1" onblur="searchid()" AutoPostBack="true" runat="server"></asp:TextBox>
    </form>
</body>
</html>







protected void Page_Load(object sender, EventArgs e)
       {
           if (Page.IsPostBack)
           {
               string id = TextBox1.Text;
               // your code here
           }


       }
   }


这篇关于一旦员工在eid文本框中输入其员工ID,我想在相应的文本框字段中显示员工的详细信息。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆