62,074
社区成员
发帖
与我相关
我的任务
分享
<script type="text/javascript" language="javascript">
function aa(obj,charkey)
{
// alert(event.charkey);
if(event.keyCode==40)
{
if(obj.id=="txtManager")
{
var aa=document.getElementById("Name_Result");
aa.focus();
}
else
{
var aa=document.getElementById("lst_Name");
aa.focus();
}
}
else
{
// __doPostBack('txtManager','');
}
obj.focus();
}
</script>
<asp:TextBox ID="txtManager" runat="server" Width="200px" onkeyup="javascript:aa(this,event.keyChar);"
OnTextChanged="txt_ManagerChange" onfocus="setCursorPos(this);"></asp:TextBox>
public void txt_ManagerChange(object sender, EventArgs e)
{
BLLUser bllUser = new BLLUser();
TextBox CurTxt = (sender as TextBox);
string nameLike = CurTxt.Text;
if (nameLike != null && nameLike.Length > 0)
{
ListBox NameList = new ListBox();
if (CurTxt.ID == "txtManager")
{
NameList = Name_Result;
}
else
{
GridViewRow row = Grv_FS.Rows[Grv_FS.EditIndex];
NameList = (row.FindControl("lst_Name") as ListBox);
}
NameList.Visible = true;
DataTable table = bllUser.GetSimilarMemberByName(nameLike);
NameList.DataSource = table;
NameList.DataTextField = "name";
NameList.DataValueField = "MemberId";
NameList.DataBind();
if (table != null && table.Rows.Count > 0)
NameList.SelectedIndex = 0;
}
CurTxt.Focus();
}