You can set a common class for your textbox inside grid and then using class you can get text box id and it's value.
here i have just given an example. it's not in grid but it should work for gridview too.
<input type="text" id="txtB1" class="commanClass" />
<input type="text" id="txtB2" class="commanClass" />
<input type="text" id="txtB3" class="commanClass" />
<input type="text" id="txtB4" class="commanClass" />
$(document).ready(function()
{
$('.commanClass').keyup(function(){
var $eleId = $(this).attr("id");
var currentVal = $(this).val();
alert($eleId);
alert(currentVal);
});
});