Hi Team,
Try to create row with no data(Empty Data Grid)webdatagrid using javascript below
var grid = $find("gridname");
var row = new Array("Enter Remark");
grid.get_rows().add(row);
It's showing below error :
Microsoft JScript runtime error: 'null' is null or not an object
Screen shot Requirement :
Previous Version It's working Fine
Thanks
Ranganathan Palanisamy
Hello,
Thank you for using our forum.
This error appear because you haven't specified values for the rest DataFields. For example if you have 5 columns, you should set values for the other 4 also.
I understand that with the old Grid adding of empty row used to be possible, although currently with the new grid it isn't.
Below you can find a couple of forum threads that will help you to gain better understanding of how to add rows client side.
http://es.infragistics.com/help/aspnet/webdatagrid_row_adding.html
http://es.infragistics.com/community/forums/t/73738.aspx
http://es.infragistics.com/community/forums/t/93139.aspx
Let me know if I may be of further assistance.
Thanks for your reply,
Still facing same issue, Please guide me to resolve the Issue, My requirement is initial form loading I am not binding data in the grid once form load.Button click event adding row grid.
1. I want empty grid should display with header only in Load ?
2. Once click the Add button should create the empty row ? I have 5 column . find the Below my script .
JavaScript :
var grid = $find("uwgRemarks");
var grows = grid.get_rows();
var growsLength = grid.get_rows().get_length();
var grow = new Array("Description", "RemDate", "RemDatetime", "Username", "ID");
grows.add(grow) ->
We need same requirement with different way . We don't want Id with dummy data totally blank multiples rows have to add on button click.
Means one click one empty row will add next click one more empty row will add without "Data key unique error".
Please guide us.
Below you will find a sample that is showing how to initialize grid only with headers without any data, and how to add row to it on button click.
I hope you will benefit from it.