id=aaaa 是服务器端的id你的代码应该用客户端的ID

解决方案 »

  1.   

    the textbox in the datagrid is has an id like DataGrid1__ctl3_aaaa, so tryif (e.id.indexOf("aaaa") > 0 && event.keyCode == 13)
                 window.alert("bzg");
      

  2.   

    if (e.id=="aaaa" && event.keyCode == 13)
                 window.alert("bzg")
    改为:
     if (e.id.indexOf("aaaa")>=0 && e.tagName=="INPUT" && event.keyCode == 13)
                 window.alert("bzg");这里的aaaa就是你的TextBox的id。
      

  3.   

    to 思归:
    为什么是一个id
      

  4.   

    you could haveDataGrid1__ctl0_aaaa
    DataGrid1__ctl1_aaaa
    DataGrid1__ctl2_aaaa
    .....
      

  5.   

    your textbox is in a template, right? DataGrid implements INamingContainer, ASP.NET will assign each control inside DataGrid a unique id/name, and the normal convention is to use "Parent1ID_Parent2ID....ChildID" for id and ""Parent1ID:Parent2ID:....ChildID" for name
      

  6.   

    just open the HTML source code from the browser, and you will understand