how to close RadGrid's EditForm?

8 posts, 0 answers
  1. vincent
    vincent avatar
    61 posts
    Member since:
    Jun 2008

    Posted 30 Apr 2009 Link to this post

    On my radgrid, I have EditFormSettings EditFormType set to WebUserControl.  Inside that WebuserControl, I have a submit button and a delete button.  And I know that you can close these by setting the CommandName to Update or Cancel.  However, this is not working when I have the another control nested inside that control. 

    Can I close these windows explicitly either through js or the codebehind?  I'm not sure but I think my problem is that I have a control nested inside another control. Both have the commandnames set to Update and Cancel.  There must be some conflict?

    Thanks in advance.

    Vince
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 04 May 2009 Link to this post

    Hi Vince,

    I tried the same scenario on my end. I set the CommandName for both the cancel buttons as Cancel and it is closing the edit form as expected.
      One another suggestion will be to set the CommandName for both the cancel button as same. In the ItemCommand event check for the CommandName and clear the edit items. Try with the following approach and see if it works.

    CS:
     
     //set the CommandName for both the buttons as CancelEdit
     protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)  
        {  
            if (e.CommandName == "CancelEdit")  
            { 
              //closes the edit form
                RadGrid1.MasterTableView.ClearEditItems();  
            }  
        }  


    Thanks
    Shinu

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Brad Hehe
    Brad Hehe avatar
    17 posts
    Member since:
    Oct 2008

    Posted 21 Sep 2009 Link to this post

    I am experiencing similar problems where in my light-weight test harness I have 2 buttons...

        <!-- Command Buttons --> 
        <asp:Button ID="CommitButton" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>' 
            runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' 
            ValidationGroup="SaveClient">  
        </asp:Button> 
        &nbsp;  
        <asp:Button ID="CancelButton" Text="Cancel" runat="server" CausesValidation="False" 
            CommandName="Cancel">  
        </asp:Button> 
     

    And when I click either, the UserControl pop-up goes away and the appropriate InserCommand / UpdateCommand event is fired.  In my real application - I click the buttons and they simply do nothing... I can tell a PostBack occurs and if I had dragged the popup window to somewhere other than the default location I see it resets back to the original default position...

    I've got debug breakpoints set in my code and what I'm tracing through is both the ItemCommand and then InsertCommand - and I am able to capture my inserted/updated entity and populate/update my data source - but the UserControl popup just lingers around... where in the other case - without any code - it closes on its own...

    So back to this original posters question - is there a way to explicitly close the popup via CodeBeind/JavaScript?  Preferrable CodeBehind in my scenario..... Seems like the API has nearly everything else so I'm hoping this code exists and its just a matter of digging into the right object(s)...

    And finally - what would cause the popup to not close automatically? I thoght it was related to use of Validation Group settings but I've removed those and the problem persists...

    It would be nice to see an example project where all of the event-handling/wire-up was done explicitly through code rather than the 'magic' that just occurs... i.e. The Grid is somehow finding the buttons on the edit form and then their CommandName is bubbled up in the ItemCommand event... and once handled the EditForm is closed...  There's code somewhere doing these things and if we had an example showing this code - we'd be able to follow it / understand it better (and alter it when needed)....

    Thanks!
  5. Brad Hehe
    Brad Hehe avatar
    17 posts
    Member since:
    Oct 2008

    Posted 23 Sep 2009 Link to this post

    I found the difference between my test harness and the real application and it boils down to this...  In the test harness I have the grid set as follows:

    <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" GridLines="None" 
        AutoGenerateDeleteColumn="True" AutoGenerateEditColumn="True"

    This auto-generated the Edit / Delete columns for me...  but in my real application, we want to create the columns in the following manner:

        <telerik:RadGrid ID="AlertListRadGrid" runat="server" AutoGenerateColumns="False" 
            AutoGenerateEditColumn="False" AutoGenerateDeleteColumn="False" GridLines="None">  
            <MasterTableView EditMode="PopUp" CommandItemDisplay="Top">  
                <Columns> 
                    <telerik:GridEditCommandColumn UniqueName="EditCommandColumn"   > 
                    </telerik:GridEditCommandColumn> 
     

    And I'm assuming I would create the Delete command column using the following:

                    <telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName"DeleteCommand"> 
                    </telerik:GridButtonColumn> 
     

    So when I try this approach and the PopUp EditForm (which again - is a UserControl) doesn't close on it's own, what is missing? I'm assuming there's something "magic" that happens when the coulmns are auto-generated that I should be able to mimic using my own columns... This is especially important if I want to implement a 'View' command such as the following topic from the support site illustrates:

    http://www.telerik.com/help/aspnet-ajax/grdpreviewoptionforwebusercontroleditform.html

    I think I get by in the case of the 'ReadOnly' scenario since the Cancel button (with its text renamed to 'Close' in this scenario) was the only button that did work when using my own Edit/Delete command columns... But all the same, maybe I have an operation to perform such as 'Approve' and I want to make the EditForm behave differently... I would still need to know how to ensure the PopUp closes upon completion of handling the 'UpdateCommand' event...


  6. Yavor
    Admin
    Yavor avatar
    11 posts

    Posted 24 Sep 2009 Link to this post

    Hello Brad,

    Basically, the edit/insert form not closing after an operation is a sign that there is an issue with the update/insert logic. I do not think that this is related to the structure of the control - however, based on this information it is hard to pinpoint the exact cause. To further trace it, please open a formal support ticket, and send us a small working project, demonstrating your setup, and the unwanted behavior. We will review it locally, and advise you further.

    Regards,
    Yavor
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  7. Abitar
    Abitar avatar
    22 posts
    Member since:
    May 2015

    Posted 26 Aug 2015 Link to this post

    Hello,

    I am using a RadGrid Batch mode (row edit) with GridButtonColumn to open a PopUp (RadWindow), All this happens on client side.

    In the grid I have data fields like Name, birth date, etc. I need to retreive data filled in the current row and show them in the PopUp. 

    I need to do this using JavaScript. 

     I used this function on the OnClientShow event of the RadWindow : 

                    var grid = $find("<%=RadGrid.ClientID%>");
                    var tableView = grid.get_masterTableView();
                    var batchManager = grid.get_batchEditingManager();
                    var items = tableView.get_dataItems();
                    var mapCell = items[index].get_cell("Nom");
                    var mapValue = batchManager.getCellValue(mapCell);
                    alert(mapValue);

    It worked when I fill the new record's details in the RadGrid and I unselect the row (I exit Edit mode) then I click on the GridButtonColumn in that row.

    But when I click on the button in the new row when its in edit mode, this function returns nothing.

    In other words, I need to retreive data from editor form of a RadGrid Batch using JavaScript.

    Any one can help ?

    Thanks for your help !

    Abbas B

                   

  8. Eyup
    Admin
    Eyup avatar
    3014 posts

    Posted 31 Aug 2015 Link to this post

    Hi Abbas,

    I've already provided a sample in the following forum:
    http://www.telerik.com/forums/radgrid-batch---how-to-retreive-data-from-editor-form-using-javascript

    I suggest that we continue our conversation on the mentioned thread. You can expect a reply there.

    Regards,
    Eyup
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  9. Abitar
    Abitar avatar
    22 posts
    Member since:
    May 2015

    Posted 31 Aug 2015 in reply to Eyup Link to this post

    Hi Eyup,

    Thank You for your reply.

    Regards, 

    Abitar

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017