iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Latest Development Blogs
Browse By Tag
I am attempting to set some default values on the client side when a new row is added to a bound WebGrid. However, when I update the row I get an error message. The cell and DB column behind, that I am writing to, is a string. If I type in the very same string, rather than setting it in the script, it works. The exception occurs during selectedRow.Update().
var WebGrid1 = ISGetObject(controlId); var selectedRow = WebGrid1.GetSelectedObject().ToRowObject(); var cells = selectedRow.GetCells(); cells.GetNamedItem("Description").SetValue("jubii"); selectedRow.Update(); return true; }
Error message: (see also attached screendump)
Server Error '/' Application
Input String was not in a correct format
Yes, the code that you have provided is almost correct. But to set the auto value of column, we will need to use SetText instead of SetValue. And also, we do not need to get the selected object and so on, because on OnBeforeAdd event, it will pass the rowObject, so we can just use that particular object. Here is the snippet to do so:
function WebGrid1_OnBeforeAdd(controlId, tblName, rowObject)
var WebGrid1 = ISGetObject(controlId);
var cells = rowObject.GetCells();
var getCell = cells.GetNamedItem("Description");
getCell.SetText("This is an auto fill", true)
I hope it helps and please, do not hesitate to ask if you have any other questions. Thank you.
Thanks, it worked
Forgot your password | Sign up
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname
Already a member? Sign in