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 get this error:
Message: Unterminated string constant
i am passing the value from code behind and some of my text have somethinh lke this:
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;
}
Do nothing. A comma has no special meaning inside a JavaScript string.
You don't need to escape the comma. You should surround the entire string with quotes:
'Foo3, In.c'
If this string is inside another string which is also single-quoted you may need to escape the quotes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With