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

[Solved] Insert new row

3 Answers 134 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
gowthami
Top achievements
Rank 1
gowthami asked on 17 Aug 2011, 03:26 PM
Hai ,

   I have Radcontextmenu in gridview.the Radcontextmenu contains insert/delete.when i click insert the new row added new row in
xaml:
 
 <telerikNavigation:RadContextMenu.ContextMenu>
                                        <telerikNavigation:RadContextMenu x:Name="contextmenu"
 ItemClick="contextmenu_ItemClick">
                                            <telerikNavigation:RadMenuItem Header="Insert"/>
                                            <telerikNavigation:RadMenuItem Header="Delete"  />
                                        </telerikNavigation:RadContextMenu>
                                    </telerikNavigation:RadContextMenu.ContextMenu>
 
 
 
 
xaml.cs:
 
   private void contextmenu_ItemClick(object sender, RadRoutedEventArgs e)
        {
 
            RadContextMenu menu = (RadContextMenu)sender;
            RadMenuItem clickeditem = e.OriginalSource as RadMenuItem;
            GridViewRow row = menu.GetClickedElement<GridViewRow>();
            if (clickeditem != null && row != null)
            {
                string header = Convert.ToString(clickeditem.Header);
                switch (header)
                {
                    case "Insert":
                        dtgProductAndService.BeginInsert();
                        break;
 
                    case "Delete":
                        dtgProductAndService.Items.Remove(row.DataContext);
                        //default;
                        break;
                }
 
            }
 
        }
last line.
But i want which row i clicked the new row will be added above the clicked row. 

3 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 17 Aug 2011, 03:47 PM
Hello Gowthami,

For the time being defining the place to insert a new item cannot be specified. A possible approach would be to add items by the special custom row - by setting ShowInsertRow property of the grid to "True". Thus every item that you insert will be displayed at the top.

 

Greetings,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
gowthami
Top achievements
Rank 1
answered on 18 Aug 2011, 06:16 AM
Hai Maya,

thanks for ur reply.


just i want new row in gridview.

for an example i click the secondrow the new row will be added between first and second.
0
Maya
Telerik team
answered on 18 Aug 2011, 06:56 AM
Hi Gowthami,

The required behavior is not supported for the time being. As mentioned previously, you are not able to specify the place where an item to be placed. You may either add it at the beginning - through the insert row (ShowInsertRow="True") or at the end - by pressing the Ins key.

 

Kind regards,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Tags
GridView
Asked by
gowthami
Top achievements
Rank 1
Answers by
Maya
Telerik team
gowthami
Top achievements
Rank 1
Share this question
or