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

Raising an "inplace insert" from the RadToolBar

6 Answers 50 Views
Grid
This is a migrated thread and some comments may be shown as answers.
tjans
Top achievements
Rank 1
tjans asked on 09 Sep 2008, 05:48 PM
I'm attempting to perform an inplace/inline insert in a RadGrid from a RadToolBarButton click event.

Editing is easy because I just set the ItemCommand = "Edit" and the inline edit templates load for me, but since the Toolbar is outside of the grid, how can I accomplish this task?

My toolbar sits above my grid and basically has an "Add New" button on it, and when clicked, it should provide me an insert row...

6 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 10 Sep 2008, 08:01 AM
Hi,

Try the code snippet below to achieve the following scenario in the ToolBar click

RadGrid1.MasterTableView.IsItemInserted=True;

Thanks,
Princy



0
Accepted
Sebastian
Telerik team
answered on 10 Sep 2008, 08:17 AM
Hi guys,

You also need to rebind the grid afterwards (invoking its Rebind() method) to reflect the changes.

All the best,
Stephen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
tjans
Top achievements
Rank 1
answered on 10 Sep 2008, 12:35 PM
Worked like a charm fellas...thanks!    
0
tjans
Top achievements
Rank 1
answered on 10 Sep 2008, 01:12 PM
A related question, so the insert command still opens the <EditTemplate>?  My <EditTemplate> contains two buttons, one with a commandname of Update and one with a commandname of Cancel.  Since there is no <InsertTemplate>, how can I set it up so the update button becomes an insert button?

I assume you'd have to get a handle on the row and hide or show the button depending on the command you've fired...unless there's a better way than that...
0
Sebastian
Telerik team
answered on 10 Sep 2008, 01:34 PM
Hello travis.jansen,

The text of the update/insert button should be automatically changed for the auto-generated edit form of the grid. If you use custom edit form (FormTemplate or WebUserControl), consider changing the text for those buttons declaratively with appropriate binding expression.

Review the following examples/help topic for more details:

http://demos.telerik.com/ASPNET/Prometheus/Grid/Examples/DataEditing/TemplateFormUpdate/DefaultCS.aspx
http://demos.telerik.com/ASPNET/Prometheus/Grid/Examples/DataEditing/UserControlEditForm/DefaultCS.aspx
http://www.telerik.com/help/aspnet-ajax/grddistinguisheditinsertmodeonitemcreateditemdatabound.html

Best regards,
Stephen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
tjans
Top achievements
Rank 1
answered on 10 Sep 2008, 01:36 PM
Well, there is no text, it's just a button and it has a command name of Update.  Does the command name of that button then automatically get changed to "Insert" when you're doing an insert?

I'll take a look at those examples, thank you for your prompt response...        
Tags
Grid
Asked by
tjans
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Sebastian
Telerik team
tjans
Top achievements
Rank 1
Share this question
or