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

[Solved] Hiding add row item upon perform insert

6 Answers 151 Views
Grid
This is a migrated thread and some comments may be shown as answers.
QualiWareUA
Top achievements
Rank 1
QualiWareUA asked on 29 Apr 2008, 10:04 AM
Hello,

I have the following issue: there is a grid with command item template which contains a link InitInsert command name. Clicking this link shows add new row item. When I specify data for item to insert and and trigger PerformInsert command, this row is not hidden. What may be the cause of such behavior and how can I fix it?

6 Answers, 1 is accepted

Sort by
0
Konstantin Petkov
Telerik team
answered on 30 Apr 2008, 11:15 AM
Hello Vladimir,

We will need to see your code to be able to determine what is causing the problem. Do you use Automatic Operations with DataSource control? Or do you bind the Grid through NeedDataSource event?

Here is a ComandItemTemplate demo with the same link button having InitInsert command name. There is nothing on the code-behind to perform the insert operation because of the automatic operations:

http://www.telerik.com/demos/aspnet/prometheus/Grid/Examples/Programming/CommandItem/DefaultCS.aspx

Sincerely yours,
Konstantin Petkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
QualiWareUA
Top achievements
Rank 1
answered on 05 May 2008, 10:10 AM
Hello Konstantin,

It seems to me that the problem is with dynamically created grid with template columns.

I have opened a support ticket for further tracking.
0
Shinu
Top achievements
Rank 2
answered on 05 May 2008, 10:47 AM
Hi Vladimir,

Try the following line of code to close the Editform on clicking the Insert button.

CS:
  e.Item.OwnerTableView.IsItemInserted = false

Shinu.
0
QualiWareUA
Top achievements
Rank 1
answered on 05 May 2008, 11:55 AM
Hi Shinu,

I have tried suggested line of code and I get:

Insert item is available only when grid is in insert mode.

Do you have any idea why it is throwing this exception?
0
Shinu
Top achievements
Rank 2
answered on 05 May 2008, 12:59 PM
Hi Vladimir,

Actually I meant that you have to write the above given code snippet in the InsertEvent after writing the code for performing the Insert operation. So once the Insert operation is finished the Insert form will be closed.

CS:
 protected void RadGrid1_InsertCommand(object source, GridCommandEventArgs e) 
    { 
        // Code to perform Insert. 
        e.Item.OwnerTableView.IsItemInserted = false
    } 



Thanks
Shinu.
0
QualiWareUA
Top achievements
Rank 1
answered on 05 May 2008, 01:39 PM
Hello Shinu,

I have made right this way.

I have also set AllowAutomaticInserts to false (previously I had it set to true) and it worked for me. Event without rebinding.

Thanks!
Tags
Grid
Asked by
QualiWareUA
Top achievements
Rank 1
Answers by
Konstantin Petkov
Telerik team
QualiWareUA
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or