日期:2014-05-16  浏览次数:20381 次

js获取gridview的ItemTemplate中textbook的值
js获取gridview的ItemTemplate中textbook的值

//js
function findNames() {
var  inputField= document.getElementById("GridView1").rows[1].cells[2].innerText;     
  alert(inputField);
}

//asp.net 
  <ItemTemplate>
       <asp:TextBox runat="server" onKeyup="findNames()"  ID="TextBoxKeyword" Width="155px"  Height="23px"></asp:TextBox>
   </ItemTemplate>

我这获取的不是在textbook中输入的值,怎么样才能获取到
------解决方案--------------------
<asp:TextBox runat="server" onKeyup="findNames(this)"  ID="TextBoxKeyword" Width="155px"  Height="23px"></asp:TextBox>

function findNames(input) {
alert(input.value)
}