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

Preventing Auto-Generated Forms

3 Answers 57 Views
Grid
This is a migrated thread and some comments may be shown as answers.
James Legan
Top achievements
Rank 1
James Legan asked on 12 Nov 2008, 08:21 PM
I have an grid where I am programatically handling the edit command (it displays a panel, etc...). However, I cannot seem to be able to prevent the auto-generated edit form from appearing below the item for which I clicked "Edit". I can make it a pop-up or even a custom form, but not prevent it. Is there a way to do this?

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 13 Nov 2008, 07:31 AM
Hello James,

I suppose you would like to prevent the EditForm from appearing for certain rows. If this is the case, then you can check for the index of the row and then cancel the event as shown in the code below.
cs:
protected void RadGrid2_EditCommand(object source, GridCommandEventArgs e) 
    { 
        GridEditableItem editItem = (GridEditableItem)e.Item; 
        int index = editItem.ItemIndex; 
        if (index == 5) 
        { 
            e.Canceled = true
        } 
    } 

Thanks
Princy.
0
James Legan
Top achievements
Rank 1
answered on 13 Nov 2008, 03:13 PM
Princy,

This worked in code behind. However, I have another grid in the panel that gets displayed when I hit edit on the primary grid (that I needed the code for). When I try and edit a value on this secondary grid, it makes the edit box visible on the primary form again. I cannot seem to find the clinet-side equiv to what you listed to prevent this from happening.
0
Shinu
Top achievements
Rank 2
answered on 14 Nov 2008, 06:36 AM
Hi James,

I am rather confused with the described scenario. From my unserstanding for displaying a panel containing the Grid outside the primary Grid  on clicking the edit button consider using a GridButtonColumn with a custom CommandName other than Edit and display the Panel from the ItemCommand event. If this is not the desired scenario sending your aspx will be more good.

Shinu.
Tags
Grid
Asked by
James Legan
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
James Legan
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or