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

[Solved] Hide Grid on edit form

2 Answers 106 Views
Grid
This is a migrated thread and some comments may be shown as answers.
AdamL
Top achievements
Rank 1
AdamL asked on 14 Sep 2009, 08:58 PM
I have a nagging requirement for my web app:  implement VB6 grid functionality.  Part of this requirement is to have an open editable grid that allows the user to press F4 to switch between grid and form view.

If the user is focused on the grid (a specific row) and presses F4 the grid switches to the edit form for that row (not showing the other rows in the grid)  when the user presses F4 again, the edit form reverts back to the grid.

Hopefully this makes some sense.  Is it possible to hide the grid except for the edit form to mimic this functionality?

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 15 Sep 2009, 06:31 AM
Hi Lindsaad,

You can achieve a similar functionality using the 'Enter' key. Try enabling the AllowKeyboardNavigation property for the Grid and then on enter key press the focused row will be set in edit mode. You may try the following code snippet to hide all the Grid rows and display only the edit form.

CS:
 
  protected void RadGrid1_PreRender(object sender, EventArgs e) 
    { 
        if (RadGrid1.EditItems.Count > 0) 
        { 
            foreach (GridDataItem item in RadGrid1.MasterTableView.Items) 
            { 
                if (item != RadGrid1.EditItems[0]) 
                { 
                    item.Visible = false
                } 
            } 
        } 
    } 


Thanks
Princy
0
AdamL
Top achievements
Rank 1
answered on 15 Sep 2009, 12:56 PM
Thanks Princy, excellent suggestion as always.  However, I cannot use the "Enter" key as the requirements are for the enter key to work the same as the tab key.  Another requirement is that the grid has to support inline editing as well as the form editing (on double click or F4).

I will play around with the pre render code to hide the grid.  Any thoughts on how to do the inline and edit form?
Tags
Grid
Asked by
AdamL
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
AdamL
Top achievements
Rank 1
Share this question
or