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

Keep Popup open after Insert/Edit

3 Answers 183 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Edward
Top achievements
Rank 1
Edward asked on 23 Apr 2009, 12:31 PM
I have a RadGrid that uses a Pop for an editform.  The Popup host a usercontrol with a OK, Close and Cancel button.  When a user selects Edit (or Insert).  They want the OK button button save the form (this works), but the form needs to stay open until the click the Close button on the form.  The automatically generated 'X' close button works so I don't want to break that.  I just need my close button (asp:LinkButton) to do the same thing.

Thanks,

Ed

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 24 Apr 2009, 06:10 AM
Hello Edward,

You can access the CloseButton and then add an event handler for the button where in you can close the edit form as shown below:
ascx:
<asp:Button ID="Button3" runat="server" CommandName="Save" Text="Save" /> 
<asp:Button ID="Button1" runat="server" CommandName="Close" Text="Close" /> 
<asp:Button ID="Button2" runat="server" CommandName="Cancel" Text="Cancel" /> 

aspx.cs:
 
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)  
    {  
      if (e.Item is GridEditableItem && e.Item.IsInEditMode)  
       {  
        GridEditFormItem editedItem = e.Item as GridEditFormItem;  
        UserControl userControl = (UserControl)editedItem.FindControl(GridEditFormItem.EditFormUserControlID); //access the user control  
        Button closebutton = (Button)userControl.FindControl("Button1");  
        closebutton.Click += new EventHandler(closebutton_Click);           
       }  
    }  
 void closebutton_Click(object sender, EventArgs e)  
    {  
        RadGrid1.MasterTableView.ClearEditItems(); //close the Edit Form 
    }  

Thanks
Princy.
0
Edward
Top achievements
Rank 1
answered on 24 Apr 2009, 09:25 AM
almost there.

How do I keep the form open after the user hits Insert or Update?
0
Shinu
Top achievements
Rank 2
answered on 24 Apr 2009, 12:09 PM

Hi Edward,

I am not sure about your scenario. If you want to keep your EditForm from closing, then you can try setting the following code immediately after the insert code or update code.


CS:
 
RadGrid1.MasterTableView.IsItemInserted = true
e.Item.Edit = true

Thanks,
Shinu.
Tags
Grid
Asked by
Edward
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Edward
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or