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
Hi Lyuba,
the input button solves my problem.
Thanks very much for your help
Hello Damien,
Unfortunately this cannot be done on the server, because the text that you have entered in the add new row doesn’t go to the server (even if you try to take the text in the cell - WebDataGrid1.Behaviors.EditingCore.Behaviors.RowAdding.Row.Items[0].Text –you will see that it is empty). I guess you are calling the _comitRow method in the event handler for OnClientCLick of some button? If this is really the case, would you try to do it on onclick of some <input type=”button”> instead. In this way, when you call the method, a partial postback will happen and your eventhandler will still execute, and you would be able to make your data treatment, but the line will go only once to the datatabase.
Let me know if this works for you.
Regards,
Lyuba Petrova
Developer Support Engineer
Infragistics
www.infragistics.com/support
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
grid.get_behaviors().get_editingCore().get_behaviors().get_rowAdding()._commitRow();
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.
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
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 %>");
}