Hi, I was browsing this topic http://www.telerik.com/help/aspnet-ajax/client-update-insert-delete.html looking for a way to insert a new item at the end of a RadGrid since I'm having a few issues. I was hoping there was a simpler way to do this. Let me briefly explain what I'm trying to do.
I'm attempting to create more of a quick data entry style grid. In order to do so every cell in every row of my grid has a RadTextBox control in which the user can enter data. If the grid initially has 3 rows of data I append a 4th row that is empty, the row designated for the next set of data to be entered. When the user types into a textBox of the last row in the grid I want to do a client-side insert of a new, empty row.
Each textBox has the following javascript function assigned to its OnKeyPress ClientEvent:
But when masterTable.insertItem() executes I get the following javascript error:
Sys.WebForms.PageRequestManagerServerErrorException: Insert item is available only when grid is in insert mode.
Is there a way I can put the grid item insert mode on the client?
Thanks in advance.
I'm attempting to create more of a quick data entry style grid. In order to do so every cell in every row of my grid has a RadTextBox control in which the user can enter data. If the grid initially has 3 rows of data I append a 4th row that is empty, the row designated for the next set of data to be entered. When the user types into a textBox of the last row in the grid I want to do a client-side insert of a new, empty row.
Each textBox has the following javascript function assigned to its OnKeyPress ClientEvent:
function DetailGridKeyPressed(sender, args) |
{ |
var masterTable = $find("<%= EntryGrid.ClientID %>").get_masterTableView(); |
var items = masterTable.get_dataItems(); |
var i = 0; |
var j = 0; |
for(i = 0; i < items.length; i++) |
{ |
if (items[i].findControl(sender.get_id()) != null) |
{ |
if (i + 1 == items.length) |
{ |
masterTable.insertItem(); |
} |
break; |
} |
} |
} |
But when masterTable.insertItem() executes I get the following javascript error:
Sys.WebForms.PageRequestManagerServerErrorException: Insert item is available only when grid is in insert mode.
Is there a way I can put the grid item insert mode on the client?
Thanks in advance.