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

Switching between edit modes

3 Answers 139 Views
Grid
This is a migrated thread and some comments may be shown as answers.
earl
Top achievements
Rank 1
earl asked on 18 Mar 2009, 10:36 PM
I have implemented the "Edit on Double-click" functionaliy found in the online demo for my grid, but I need users to be able to edit in popup mode using a form template if they click a button column that I have added. That same popup needs to be used for new item inserts as well.

Here is the column I added:
<telerik:GridButtonColumn ButtonType="LinkButton" CommandName="Edit2" Text="Edit2"></telerik:GridButtonColumn> 

and here is the code behind:
Protected Sub radgridItems_ItemCommand(ByVal source As ObjectByVal e As Telerik.Web.UI.GridCommandEventArgs)  
 
        If e.CommandName = RadGrid.InitInsertCommandName Then 'add new item clicked 
 
            If radgridItems.MasterTableView.EditMode <> GridEditMode.PopUp Then 
                radgridItems.MasterTableView.EditMode = GridEditMode.PopUp 
                radgridItems.Rebind() 
            End If 
 
            e.Canceled = True 
            e.Item.OwnerTableView.InsertItem() 
 
    ElseIf e.CommandName = "Edit2" Then 'custom button 
 
            If radgridItems.MasterTableView.EditMode <> GridEditMode.PopUp Then 
                radgridItems.MasterTableView.EditMode = GridEditMode.PopUp 
                radgridItems.Rebind() 
            End If 
 
            radgridItems.MasterTableView.Items(e.CommandArgument()).Edit = True 
            radgridItems.Rebind() 
 
        ElseIf e.CommandName = "Edit" Then 'normal edit 
 
            If radgridItems.MasterTableView.EditMode <> GridEditMode.InPlace Then 
                radgridItems.MasterTableView.EditMode = GridEditMode.InPlace 
                radgridItems.Rebind() 
            End If 
 
            radgridItems.MasterTableView.Items(e.Item.ItemIndex).Edit = True 
            radgridItems.Rebind() 
 
        End If 
 
End Sub 

The problem is that the popup does not display when the user clicks the "Edit2" column or when they click "Add new record". Curiously though, the row is highlighted in yellow as if it was set to edit mode. What am I doing wrong here?


3 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 24 Mar 2009, 08:50 AM
Hello earl,

I suggest you review the implementation for the second grid in this online demo of the product:

http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/popupeditform/defaultcs.aspx

Additionally, note that you do not need to rebind the grid explicitly from within the ItemCommand handler when regular Edit on InitInsert command is triggered because these are two of the actions which rebind the control implicitly. You may also test whether setting the popup edit mode declaratively makes a difference.

Best regards,
Sebastian
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
earl
Top achievements
Rank 1
answered on 25 Mar 2009, 06:17 AM
Hi,

I appreciate your response, but I don't see how that link relates to my issue specifically. I noticed that if I set the EditMode to EditForms then everything works okay. After more digging, I determined that the issue is somehow related to using ASP RequiredFieldValidator controls on a template edit form in combination with programmatically switching the edit mode to PopUp. The Grid appears to enter edit mode, but the popup itself does not appear and the OnPopup event does not fire. Removing the RequiredFieldValidators makes the popup work fine. Have you seen anything like this before?

Thank you,
Earl
0
Sebastian
Telerik team
answered on 25 Mar 2009, 09:26 AM
Hi earl,

We have not been contacted with regards to a similar problem before. The best means to progress in our investigation is to assemble a stripped working version of your project, illustrating the abnormality, and send it enclosed to a regular support ticket. We will test/debug it locally and will get back to you with our findings.

Kind regards,
Sebastian
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
earl
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
earl
Top achievements
Rank 1
Share this question
or