EDIT1:
btnDelete.Attributes.Add("onclick", String.Format(@"return DeleteRow('{0}',{1},{2},{3});", e.Row.ClientID, e.Row.RowIndex, DataBinder.Eval(e.Row.DataItem, "Id"), "'" + DataBinder.Eval(e.Row.DataItem, "Name") + "'"));
Edit:
I encountered an error saying:
Message: Unterminated string constant
When passing values from code behind, some of my text contains special characters such as:
Foo3, In.c
//javascript
function DeleteRow(rowId, rowIdx, Id, Name) {
var textForMessage = "return confirm('Are you sure you want to delete this record with the name: \n{0} \n{1}');";
//removed code...
return result;
}