Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
872
can't add new row from webdatagrid
posted

in ASP.NET 19.2 I have a webdatagrid with a sql datasource.  Set behaviors to allow an "add row".

I see the addrow and I type in the info for the new record:

However, I can't seem to get the grid to add this record or update the datasource.  Tried clicking another record to make the addrow lose focus, and also tried to move a column to force a postback, but nothing seems to work.  What am I missing?

Parents
  • 620
    Offline posted

    Hello,

    Thank you for posting in our community.

    To add the row you have to use Tab or Enter key. To add row when the focus is lost, the Activation behavior has to be enabled and the selection one disabled. If the selection is needed then the client-side event ExitedEditMode on the rowAdding behavior can be handled as follows:

    <ig:RowAdding>
    	<AddNewRowClientEvents ExitedEditMode="WebDataGrid1_RowAdding_ExitingEditMode" />
    </ig:RowAdding>

    function WebDataGrid1_RowAdding_ExitingEditMode(sender, eventArgs) {
    	var rowAdding = sender.get_behaviors().get_editingCore().get_behaviors().getBehaviorByName("RowAdding");
    	rowAdding._commitRow();
    }

    Please let me know if you need any further assistance with this matter.

Reply Children