Hello... I am using a custom template for editing or inserting elements in a grid. I implemented the UpdateCommand where I call a stored procedure in order to add or update information.
Before that event returns, I am calling Rebind method of the grid which causes the edited item be refreshed, but the edit form remains visible. How can I hide the edit form?
Any help will be greatly appreciated.
Thanks
Jaime
Before that event returns, I am calling Rebind method of the grid which causes the edited item be refreshed, but the edit form remains visible. How can I hide the edit form?
Any help will be greatly appreciated.
Thanks
Jaime
9 Answers, 1 is accepted
0
Accepted
Princy
Top achievements
Rank 2
answered on 14 Oct 2008, 04:04 AM
Hello Jaime,
Have you set the AllowAutomaticUpdates to true? If yes, try setting it to false and then see if the editform disappears. If not, you can add the following line of code to hide the edit form after performing update.
cs:
Thanks
Princy.
Have you set the AllowAutomaticUpdates to true? If yes, try setting it to false and then see if the editform disappears. If not, you can add the following line of code to hide the edit form after performing update.
cs:
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) |
{ |
if (e.CommandName == RadGrid.UpdateCommandName) |
{ |
// code to update |
RadGrid1.MasterTableView.ClearEditItems(); |
} |
} |
Thanks
Princy.
0
Jaime
Top achievements
Rank 1
answered on 14 Oct 2008, 01:08 PM
Hello Princy... thanks for your reply.
What you suggested worked only when updating an item. When the insert form is visible, using the ClearEditItems method doesn't have effect.
This is the whole implementation of UpdateCommand I have (which is called when inserting:and updating)
Any further help would be greatly appreciated,
Jaime
What you suggested worked only when updating an item. When the insert form is visible, using the ClearEditItems method doesn't have effect.
This is the whole implementation of UpdateCommand I have (which is called when inserting:and updating)
protected void grdTipoEvento_UpdateCommand(object source, GridCommandEventArgs e) |
{ |
if (e.Item is GridEditFormInsertItem) |
FrameWork.Logging.TipoEvento.AgregarTipoEvento((e.Item.FindControl("txtNombre") as TextBox).Text); |
else |
FrameWork.Logging.TipoEvento.ActualizarTipoEvento(Convert.ToInt32(grdTipoEvento.MasterTableView.DataKeyValues[e.Item.ItemIndex]["Codigo"]), (e.Item.FindControl("txtNombre") as TextBox).Text, true); |
grdTipoEvento.MasterTableView.ClearEditItems(); |
grdTipoEvento.Rebind(); |
} |
} |
Any further help would be greatly appreciated,
Jaime
0
Accepted
Princy
Top achievements
Rank 2
answered on 15 Oct 2008, 03:36 AM
Hello Jaime,
To close the insert form after inserting an item, you can replace the above given line of code with the following code after performing the insert operation.
cs:
Thanks
Princy.
To close the insert form after inserting an item, you can replace the above given line of code with the following code after performing the insert operation.
cs:
RadGrid1.MasterTableView.IsItemInserted = false; |
Thanks
Princy.
0
Steve Todd
Top achievements
Rank 1
answered on 10 Mar 2009, 05:22 PM
I can't get my Insert form to disappear. I've followed the examples on the site but I have obviously missed something.
I have AllowAutomaticInserts="false" and AllowAutomaticUpdates="false" and this as the item command from this thread but the insert form remains and I get the error "Insert Item Is Available Only When The Grid Is In Insert Mode"
Can you give me working example in VB instead of C#?
Cheers
Steve
I have AllowAutomaticInserts="false" and AllowAutomaticUpdates="false" and this as the item command from this thread but the insert form remains and I get the error "Insert Item Is Available Only When The Grid Is In Insert Mode"
Protected Sub rgrdEntry_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles rgrdEntry.ItemCommand
Try
If (TypeOf e.Item Is GridEditFormInsertItem) Then
If e.CommandName = "PerformInsert" Then
rgrdEntry.MasterTableView.IsItemInserted =
False
End If
End If
Catch ex As Exception
End Try
End Sub
Can you give me working example in VB instead of C#?
Cheers
Steve
0
Princy
Top achievements
Rank 2
answered on 11 Mar 2009, 09:42 AM
Hello Steve,
Try modifying your code as follows and see if it helps:
cs:
Thanks
Princy.
Try modifying your code as follows and see if it helps:
cs:
Protected Sub rgrdEntry_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles rgrdEntry.ItemCommand |
Try |
If e.CommandName = "PerformInsert" Then |
If (TypeOf e.Item Is GridEditFormInsertItem) Then |
rgrdEntry.MasterTableView.IsItemInserted =False |
End If |
End If |
Catch ex As Exception |
End Try |
End Sub |
Thanks
Princy.
0
Steve Todd
Top achievements
Rank 1
answered on 11 Mar 2009, 09:57 AM
Hi
Thanks for the quick reply, but no joy with the code you suggested. I get a web page error
Insert item is available only when grid is in insert mode.
I've noticed the MasterTableView.IsItemInserted = False within the ItemCommand method gets executed before the InsertCommand method. Would this be the cause of the above error?
Steve
Thanks for the quick reply, but no joy with the code you suggested. I get a web page error
Insert item is available only when grid is in insert mode.
I've noticed the MasterTableView.IsItemInserted = False within the ItemCommand method gets executed before the InsertCommand method. Would this be the cause of the above error?
Steve
0
Nicolaï
Top achievements
Rank 2
answered on 25 Mar 2009, 09:11 AM
Having the same issue...
My config: the grid is not allowing edits/inserts/deletes by default, and based on " is admin checks" I change the attributes to true.
My config: the grid is not allowing edits/inserts/deletes by default, and based on " is admin checks" I change the attributes to true.
0
Hi Nicolai,
If the directions provided so far in this thread are not helpful, I suggest you prepare a small working version of your project, illustrating the issue, and send it enclosed to a regular support ticket. We will examine your entire code implementation in detail 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.
If the directions provided so far in this thread are not helpful, I suggest you prepare a small working version of your project, illustrating the issue, and send it enclosed to a regular support ticket. We will examine your entire code implementation in detail 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.
0
Nicolaï
Top achievements
Rank 2
answered on 25 Mar 2009, 09:29 AM
Hello,
I just understood why now.. (thx to http://www.telerik.com/community/forums/aspnet/grid/after-insert-the-edit-form-visible.aspx)
The reason it wasn't working is the grid needs to be AllowAutomaticInserts=false in order to use the code: .IsItemInserted = False.
So as a workaround, I do:
Protected Sub commentsDG_InsertCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles commentsDG.InsertCommand
commentsDG.AllowAutomaticInserts = False
commentsDG.MasterTableView.AllowAutomaticInserts = False
[...code...]
commentsDG.MasterTableView.IsItemInserted = False
End Sub
(And the admin check puts it back to AllowAutomaticInserts, on page load)
All works now...
(ps: sending code is hard when you're working with sensitive data. I'm just a programmer and I do not want to take any chances when it comes to the clients rules.. It usually requires more work to make a neutral sample than finding another way :/)
I just understood why now.. (thx to http://www.telerik.com/community/forums/aspnet/grid/after-insert-the-edit-form-visible.aspx)
The reason it wasn't working is the grid needs to be AllowAutomaticInserts=false in order to use the code: .IsItemInserted = False.
So as a workaround, I do:
Protected Sub commentsDG_InsertCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles commentsDG.InsertCommand
commentsDG.AllowAutomaticInserts = False
commentsDG.MasterTableView.AllowAutomaticInserts = False
[...code...]
commentsDG.MasterTableView.IsItemInserted = False
End Sub
(And the admin check puts it back to AllowAutomaticInserts, on page load)
All works now...
(ps: sending code is hard when you're working with sensitive data. I'm just a programmer and I do not want to take any chances when it comes to the clients rules.. It usually requires more work to make a neutral sample than finding another way :/)