这应该使用客户端脚本(javascript/vbscript)来实现,vb.net目前还只能用在服务器端,你能忍受每按一次上下键就提交一次的速度吗?

解决方案 »

  1.   

    function inventoryValid(field)  //输入镜片库存明细用箭头控制焦点.
    {

    //alert(field.id);
    xs=document.frmInventory1.kxs.value;
    xe=document.frmInventory1.kxe.value;
    xk=document.frmInventory1.kxk.value;
    ys=document.frmInventory1.kys.value;
    ye=document.frmInventory1.kye.value;
    yk=document.frmInventory1.kyk.value;
    var x,y,strcode;
    mid =field.id;
    strx=mid.substr(1,4);
    stry=mid.substr(5,4);
    if(event.keyCode==37)//左
    {
    y=(parseFloat(stry)/100 - parseFloat(yk))*100;
    if(y==(parseFloat(ys)-parseFloat(yk))*100)
    {
    strcode=mid;
    }
    else
    {
    if(y.toString().length==1)
    {
    strcode="p"+strx+"000"+y.toString();
    }
    else if(y.toString().length==2)
    {
    strcode="p"+strx+"00"+y.toString();
    }
    else if(y.toString().length==3)
    {
    strcode="p"+strx+"0"+y.toString();
    }
    else
    {
    strcode="p"+strx+y.toString();
    }
    }
    }
    else if(event.keyCode==38) //上
    {
    x=(parseFloat(strx)/100 - parseFloat(xk))*100;
    if(x==(parseFloat(xs)-parseFloat(xk))*100)
    {
    strcode=mid;
    }
    else
    {
    if(x.toString().length==1)
    {
    strcode="p"+"000"+x.toString()+stry;
    }
    else if(x.toString().length==2)
    {
    strcode="p"+"00"+x.toString()+stry;
    }
    else if(x.toString().length==3)
    {
    strcode="p"+"0"+x.toString()+stry;
    }
    else
    {
    strcode="p"+strx+y.toString();
    }
    }
    }
    else if(event.keyCode==39) //右
    {
    y=(parseFloat(stry)/100 + parseFloat(yk))*100;
    if(y==(parseFloat(ye)+parseFloat(yk))*100)
    {
    strcode=mid;
    }
    else
    {
    if(y.toString().length==1)
    {
    strcode="p"+strx+"000"+y.toString();
    }
    else if(y.toString().length==2)
    {
    strcode="p"+strx+"00"+y.toString();
    }
    else if(y.toString().length==3)
    {
    strcode="p"+strx+"0"+y.toString();
    }
    else
    {
    strcode="p"+strx+y.toString();
    }
    }
    }
    else if(event.keyCode==40) //下
    {
    x=(parseFloat(strx)/100 + parseFloat(xk))*100;
    if(x==(parseFloat(xe)+parseFloat(xk))*100)
    {
    strcode=mid;
    }
    else
    {
    if(x.toString().length==1)
    {
    strcode="p"+"000"+x.toString()+stry;
    }
    else if(x.toString().length==2)
    {
    strcode="p"+"00"+x.toString()+stry;
    }
    else if(x.toString().length==3)
    {
    strcode="p"+"0"+x.toString()+stry;
    }
    else
    {
    strcode="p"+strx+y.toString();
    }
    }
    }
    document.frmInventory1[strcode].focus();
    }
      

  2.   

    注册事件
    tb=new TextBox();
    tb.ID="p"+this.GetDegreeZ(float.Parse(xs)+k*float.Parse(xk))+this.GetDegreeZ(float.Parse(ys)+j*float.Parse(yk));
    tb.Height=System.Web.UI.WebControls.Unit.Pixel(18);
    tb.Width=System.Web.UI.WebControls.Unit.Pixel(33);
    tb.CssClass="txtBoxRight";
    tb.BorderStyle=System.Web.UI.WebControls.BorderStyle.None;
    tb.Attributes["onKeyDown"]="inventoryValid(this)";
      

  3.   

    能否讲解一下,我看的头都大了,另外有VB.NET代码吗?我不懂C#
      

  4.   

    关注, sunxiaoli(秦朝) 兄:能把你的.aspx的源码全贴出来看一下吗?