Hello,
I have a webdata grid with a rowadding property.
At the top of the grid, I have a "save" button, so when I click this button, I would like to have exactly the same that when I press enter key.
So in other word, when I click on my "save" button, I would like to trigger the server side event "GridSpecBottom_RowAdding" for my grid GridSpecBottom.
Is it possible?
If not, how could I read values in this row?
I have tried
GridSpecBottom.Behaviors.EditingCore.Behaviors.RowAdding.Row.Items[0].Value.ToString()
but it returns null even if I have a data in my cell.
Thanks for your help
Hello Damien,
Do you want this Save button to do the job on the server? If this is not obligatory for you I am suggesting you your save button to be an html input field and to handle its onclick event:
<input type="button" ID="Button1" OnClick="addRow();" Value="Save" />
The addRow method should look something like this:
function addRow() {
var grid = $find("<%=WebDataGrid1.ClientID %>");
grid.get_behaviors().get_editingCore().get_behaviors().get_rowAdding()._commitRow();
}
Regards,
Lyuba Petrova
Developer Support Engineer
Infragistics
www.infragistics.com/support
Hi Lyuba,
No problems for me, the code to save is server side so it is not a problem if I write some js code.
I tested it and it works perfectly!
Thanks very much
Best Regards
Damien
After some tests, I have a problem with the client side code: In the row adding event, I make some data treatment in order to save the inserted line in my sql table, then the page is reloaded.
Using the client side code you gave me, the line is displayed twice in my grid: the first one by this line in BLOCKED SCRIPT
then the grid is displayed again using the rowadding event and I have again the new line inserted. So do you have the server side code equivalent to grid.get_behaviors().get_editingCore().get_behaviors().get_rowAdding()._commitRow();?
Or the possibility to delete this line in the grid?
I would like just add that my grid is in an update panel, and when I hit F5, the duplicated line is removed.