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

insert returns to Update Command

6 Answers 90 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andy Stapleton
Top achievements
Rank 1
Andy Stapleton asked on 30 Dec 2008, 12:15 PM
I specified the user control on the grid to call for update/insert/delete,  

It seems that when I click the Insert button it does call the form, but once clicking the form SUBMIT button (itemcommand = Update) , it returns to the Radgrid1_UpdateCommand()  instead of the RadGrid1_InsertCommand 


what did I do wrong

seems that once the usercontrol is called, it sets as a UPDATE instead of INSERT... 

6 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 30 Dec 2008, 12:24 PM
Hi Andy,

Please, make sure that you have specified the correct command names for the buttons, and are toggling on/off the visibility, depending on whether the control is in insert or edit mode:

.ascx
<tr> 
        <td align="right" colspan="2">  
            <asp:button id="btnUpdate" text="Update" runat="server" CommandName="Update" Visible='<%# !(DataItem is Telerik.Web.UI.GridInsertionObject) %>'></asp:button> 
            <asp:button id="btnInsert" text="Insert" runat="server" CommandName="PerformInsert" Visible='<%# DataItem is Telerik.Web.UI.GridInsertionObject %>'></asp:button> 
            &nbsp;  
            <asp:button id="btnCancel" text="Cancel" runat="server" causesvalidation="False" commandname="Cancel"></asp:button></td>  
    </tr> 

Regards,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Andy Stapleton
Top achievements
Rank 1
answered on 30 Dec 2008, 01:54 PM
yes, found that in the examples... 

and it did put in the right area, but 

 <td colspan="2">
            &nbsp;<telerik:RadTextBox ID="txtBalance" runat="server" EmptyMessage="Enter current balance"
                Skin="Inox" Width="168px" Text='<%# DataBinder.Eval(Container,"DataItem.AcctBalance") %>'>
            </telerik:RadTextBox></td>
    </tr>
    <tr>
        <td style="width: 100px">
        </td>
        <td style="width: 108px">
        </td>
        <td style="width: 100px">
        </td>
    </tr>
    <tr>
        <td colspan="3" style="text-align: center">
        <asp:button id="btnUpdate" text="Update" runat="server" CommandName="Update" Visible='<%# !(DataItem is Telerik.Web.UI.GridInsertionObject) %>'></asp:button>  
        <asp:button id="btnInsert" text="Insert" runat="server" CommandName="PerformInsert" Visible='<%# DataItem is Telerik.Web.UI.GridInsertionObject %>'></asp:button>  

you can see where I am Using DataItem in the fields and no errors, and it does work, 

but for both buttons I get  "the Name DataItem Does not Exists in Current Context"  ,,,, don't think it should be giving me that error based on the example code that is the same..



0
Andy Stapleton
Top achievements
Rank 1
answered on 30 Dec 2008, 03:38 PM
still need the answer ,but used the ItemCommand to call 2 different forms for now...



0
Yavor
Telerik team
answered on 05 Jan 2009, 12:38 PM
Hello Andy,

I cannot say for sure what is causing this exception. If the issue persists, you can open a formal support ticket, and send us a small sample, demonstrating your implementation, for further investigation.

Regards,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Matt
Top achievements
Rank 1
answered on 10 Jul 2011, 07:56 PM
Has there been a solution to this issue?

I am having the same issue.. using the Demo code for this I have the same results.. no matter if I "edit" a record or "Insert" a record, 
only the "Update" ever shows, "Insert" Button never does.

Q1 2011...

Here is the code I'm using:
RadGrid is 
           AllowAutomaticInserts="true"
           AllowAutomaticUpdates="true"
           AllowAutomaticDeletes="true" 
  
  
Command buttons:  "Insert" Button never shows.
                                <td colspan="99">
                                    <asp:Button 
                                        ID="btnUpdate" 
                                        Text="Update" 
                                        runat="server" 
                                        CommandName="Update" 
                                        Visible='<%# !(Container is Telerik.Web.UI.GridInsertionObject) %>'>
                                    </asp:Button>
                                    <asp:Button 
                                        ID="btnInsert" 
                                        Text="Insert" 
                                        runat="server" 
                                        CommandName="PerformInsert"
                                        Visible='<%# Container is Telerik.Web.UI.GridInsertionObject %>'>
                                    </asp:Button>

Thanks,

Matt
0
Iana Tsolova
Telerik team
answered on 14 Jul 2011, 08:21 AM
Hi Matt,

Can you share the whole grid declaration? I will try to build up a sample based on it and see what went wrong there.

All the best,
Iana
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Grid
Asked by
Andy Stapleton
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Andy Stapleton
Top achievements
Rank 1
Matt
Top achievements
Rank 1
Iana Tsolova
Telerik team
Share this question
or