This is a migrated thread and some comments may be shown as answers.

Custom editable RadGrid

1 Answer 56 Views
Grid
This is a migrated thread and some comments may be shown as answers.
kia
Top achievements
Rank 1
kia asked on 13 Nov 2011, 09:26 AM
Hi
I want to have a RadGrid editable with these properties:
1- Add and remove Row in client side.
2- Enter value of each column in client side without saving anything in database still user click Save button.
3- Manage client side keypress such as press Tab button that cause go to next column or next row in RadGrid.

How can i have it?

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 16 Nov 2011, 11:58 AM
Hello Kia,

Straight to your questions.

1) Try the following code to Add new record.
JS:
function OnClientClick()
   {
    var grid = $find("<%=RadGrid1.ClientID %>");
    var masterTable = grid.get_masterTableView();
    masterTable.fireCommand("InitInsert", "");
    return false;
   }

Try the following to Delete a record.
JS:
  var currentRowIndex;
  function deleteCurrent()
    {
        var table = $find("<%= RadGrid1.ClientID %>").get_masterTableView().get_element();
        var row = table.rows[currentRowIndex];
        table.deleteRow(currentRowIndex);
        var dataItem = $find(row.id);
        if (dataItem)
        {
            dataItem.dispose();
        }
    }
  function OnRowSelected(sender, args)
  {
   currentRowIndex = args.get_gridDataItem().get_element().rowIndex;
  }

2) That is the default behavior of RadGrid,it only saves values after clicking the insert button.

3) In RadGrid you can easily achieve this by setting AllowKeyboardNavigation property in ClientSettings as true.

Thanks,
Shinu.
Tags
Grid
Asked by
kia
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or