Hi, not use OnClientClick="return val();"
Use below code:
at rowdatabound event, find control for Button and text box.
then write
button1.attributes.Add("onclick", "javascript:return val('"+txtBx.ClientID+"');");
now, in the JS function, insert one parameter in your function.
function val(txtBx)
{
txtBxObj = document.getElementById(txtBx);
if(txtBxObj.value =="")
{
return false;
}
}
and check value of textbox.