could you please show any example how to work with radgrid client side events
how to insert new item using masterTable.insertItem(obj) then rebind the grid.
update and delete operation client side without using web methods
i've been trying to insert new item for too long now, the methods works fine without throwing any exception, but nothing added to the grid.
Thanks in advanced
5 Answers, 1 is accepted
I suggest that you take a look at the following online resources:
Client-side update/insert/delete help topic
Client-side update/insert/delete demo
Let me know whether they helped you.
Kind regards,
Mira
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
but both links you have sent using WebMethod to insert or update.
i wonder if i can Insert new item using javascript
Well, below is a sample code, if you could check it that would be great.
//JSON
var
taxpayerEmployment =
{
Employer:
null,
StartDate:
null,
EndDate:
null,
Notes:
null,
create:
function() {
var obj = new Object();
obj.StartDate =
"";
obj.EndDate =
"";
obj.Notes =
"";
obj.Employer =
"";
return obj;
}
};
var Employer =
{
Tin:
null,
Name:
null,
Type:
null,
Authority:
null,
create:
function() {
var employerObj = new Object();
employerObj.Tin =
'';
employerObj.Name =
'';
employerObj.Type =
'';
employerObj.Authority =
'';
return employerObj;
}
}
The am trying to insert new item
function
AddNewItem() {
TaxpayerEmployment.create();
TaxpayerEmployment.Id =
'1';
TaxpayerEmployment.Name =
'TestName';
TaxpayerEmployment.StartDate =
'';
TaxpayerEmployment.EndDate =
'';
TaxpayerEmployment.Type =
'Employee';
var masterTable = $find("<%= grdWorkPlace.ClientID %>").get_masterTableView();
masterTable.insertItem(TaxpayerEmployment);
masterTable.showInsertItem(
true);
When i run the code, i got no exceptions but at the same time, nothing is added to the gird!
is it doable? if yes what am missing
Thanks in advanced
Thank you for getting back to us.
I am afraid that what you are trying to achieve is not that easy - when your grid is databound client-side, you should insert the new records through an external form and rebind the grid as it is shown in the Client-side update/insert/delete help topic.
Kind regards,
Mira
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Thanks for your reply, still not clear about it.
again the link u've sent using Webmethod to get the collection and then rebind the grid.
What am trying to do, is to add new items using javascript not using Web methods. is it doable?
its something like
after getting the id for the master table
i wanna use the Insertitem method then to load it into the gird. (javascript)
Thanks again in advanced.
The code snippets you sent in your previous post looks fine to me, but as I said you should use external form to insert records in client-side bound grid and rebind the grid using its client-side rebind() method after insertion. You could not use the built-in edit forms, be it either auto-generated ot templated ones with client-side bound grid as they require postback to open and close.
Please note that no matter how is the grid bound, with WebMethos, PageMethods or Declarative binding, in order the changes/insertion to take effect, the grid should be rebound.
Kind regards,
Mira
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.