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

[Solved] how to hide edit form

2 Answers 197 Views
Grid
This is a migrated thread and some comments may be shown as answers.
arijit
Top achievements
Rank 1
arijit asked on 10 Sep 2009, 06:59 AM
Hi,
I am using one rad grid 

 

 

<

telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" Skin="Office2007" AutoGenerateEditColumn="false" 

 

 

OnNeedDataSource="NeedData" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" 

 

 

OnInsertCommand="Insert" OnUpdateCommand="Update"> 
<MasterTableView CommandItemDisplay="TopAndBottom"> 

 

 

<Columns> 

 

 

<telerik:GridTemplateColumn UniqueName="Attribute"> 

 

 

<ItemTemplate> 

 

 

<asp:Label ID="Label1" runat="server" Text='<%# Bind( "Attribute" ) %>'></asp:Label> 

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn> 

 

 

<telerik:GridTemplateColumn UniqueName="Val"> 

 

 

<ItemTemplate> 

 

 

<asp:Label ID="Label2" runat="server" Text='<%# Bind( "Val" ) %>'></asp:Label> 

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn> 

 

 

 

<telerik:GridEditCommandColumn HeaderText="Action"> 

 

 

</telerik:GridEditCommandColumn> 

 

 

</Columns> 

 

 

<EditFormSettings EditFormType="Template"> 

 

 

<FormTemplate> 

 

 

<asp:TextBox ID="txtAttribute" runat="server" Text='<%# Bind( "Attribute" ) %>'></asp:TextBox> 

 

 

<asp:TextBox ID="txtVal" runat="server" Text='<%# Bind( "Val" ) %>'></asp:TextBox> 

 

 

 

<asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>' 

 

 

runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'> 

 

 

</asp:Button>&nbsp; 

 

 

<asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" 

 

 

CommandName="Cancel"></asp:Button> 

 

 

</FormTemplate> 

 

 

</EditFormSettings> 

 

 

</MasterTableView> 

 

 

</telerik:RadGrid>

 

 

 

Now how to hide the edit form after the Insert ? like the cancel

 

protected

void Insert(object source, GridCommandEventArgs e)

 

{

// some code



please help, it is very urgent.

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 10 Sep 2009, 07:22 AM
Hello Arjit,

If you are performing the Insert operation manually, then you would have to set AllowAutomaticInserts to false, so that the Insert form closes automatically. If this does not help you can also try the following line of code in the Insert Command after the insert operation code:

c#:
e.Item.OwnerTableView.IsItemInserted = false;

Thanks
Princy
0
arijit
Top achievements
Rank 1
answered on 10 Sep 2009, 09:07 AM
Thanks
First option worked.
Regards
Tags
Grid
Asked by
arijit
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
arijit
Top achievements
Rank 1
Share this question
or