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

[Solved] RadGrid Buttons

4 Answers 162 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Roman
Top achievements
Rank 1
Roman asked on 16 Sep 2009, 02:31 PM
Hi

In a RadGrid I created a FormTemplate for the EditFormSettings. This looks like following:

 <telerik:RadGrid ID="PartnerListGrid" runat="server" 
        AllowSorting="True" GridLines="None" Skin="Vista" ShowGroupPanel="True"  
        OnItemDataBound="PartnerListGrid_ItemDataBound" AutoGenerateColumns="False"  
        OnCancelCommand="PartnerListGrid_CancelCommand"  
        oninsertcommand="PartnerListGrid_InsertCommand"  
        onupdatecommand="PartnerListGrid_UpdateCommand"
 
... 
 
<EditFormSettings EditFormType="Template"
                <FormTableItemStyle Width="100%"></FormTableItemStyle> 
                <FormTableStyle GridLines="None" CellSpacing="0" CellPadding="2"></FormTableStyle> 
                <FormStyle Width="100%" BackColor="white"></FormStyle> 
                <EditColumn UniqueName="EditCommandColumn1"
                </EditColumn> 
                <FormTemplate> 
                    <table id="Table2" cellspacing="2" cellpadding="1" width="100%" border="0" rules="none" 
                        style="border-collapse: collapse"
                        <tr>...</tr> 
                        <tr>...</tr> 
                        <tr> 
                            <td align="right" colspan="2"
                                <asp:Button ID="btnUpdate" Text="Update" runat="server" CommandName="Update"></asp:Button> 
                                <asp:Button ID="btnInsert" Text="Insert" runat="server" CommandName="PerformInsert"></asp:Button>&nbsp; 
                                <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel"></asp:Button> 
                            </td> 
                        </tr> 
                    </table> 
                </FormTemplate> 
            </EditFormSettings> 

There we have the three buttons for update, insert and cancel. In the code behind I have...

protected void PartnerListGrid_CancelCommand(object source, GridCommandEventArgs e) 
        { 
            PartnerListGrid.MasterTableView.ClearEditItems(); 
        } 

...but the event just doesn't get fired. I made it all over the gui. I have no idea what went wrong.
(Since I had several errors before about invalid postback or callback arguments I switched off EventValidation. Thought this probably has to be mentioned..)

Thanks in advance for some help
Regards
Roman

PS: Please don't hesitate to tell me if you require further information.






4 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 16 Sep 2009, 04:23 PM
Hello Roman,

I recommend you try to resolve the previous error instead of disabling the event validation. "Invalid postback or callback argument" error is usually seen when you rebind RadGrid on Page_Init. If you attach a runnable version of your project (to format support ticket) I will be able to debug it locally and then provide more to-the-point answer.

Best regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Roman
Top achievements
Rank 1
answered on 18 Sep 2009, 07:56 AM
Dear Daniel

I sent a support ticket yesterday including the project & database.
I'll then write down the solution here.

Thanks in advance
Roman
0
Accepted
Roman
Top achievements
Rank 1
answered on 18 Sep 2009, 08:54 AM
I found a solution to the problem.
The definition of the datasource took place in the Page_Load event, which was leading to several problems. Moving the RadGrid.DataSource Definition to the (previously defined) NeedDataSource event of the Grid solved the problem.

Hope this helps for future cases
Best
Roman
0
Daniel
Telerik team
answered on 23 Sep 2009, 05:00 PM
Hello Roman,

Thank you for sharing the solution with our community. I marked your post as "answer" to mark that the problem has been solved.

Kind regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Roman
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Roman
Top achievements
Rank 1
Share this question
or