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

grid inside ms accordion

2 Answers 107 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bob
Top achievements
Rank 1
Bob asked on 14 Oct 2008, 09:58 PM
Hi folks,

Got a small problem with my grid.

I have a grid with a template column as follows:
                                <ItemTemplate>
                                    <asp:Label ID="lblDiscountname" runat="server" Text=""></asp:Label>
                                    <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/images/edit_icon.gif" CommandName="Edit" CausesValidation="False"
                                        CommandArgument=<%# Eval("DiscountID") %> />
                                    <asp:ImageButton ID="ImageButton2" runat="server" ImageUrl="~/images/delete_icon.gif" CausesValidation="False" CommandName="Delete" ToolTip="Delete Discount"
                                    CommandArgument=<%# Eval("DiscountID") %> />
                                    <cc1:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" TargetControlID="ImageButton2" ConfirmText="Are you sure you want to delete this Discount?">
                                    </cc1:ConfirmButtonExtender>
                                </ItemTemplate>

This works great in a page I have, where I use the gridDiscounts_DeleteCommand
and
gridDiscounts_EditCommand

to do deletes and edits.

Now, on another page, I have embedded a clone of the grid into a databound standard microsoft accordion.

The events of course, no longer have the Handles clause on them, but they do fire.
The problem is, they fire every OTHER click.

So, If I click on record 1's edit button, I can see the event fire, If I click on any records edit buton again, it does NOT fire.
A third click again fires the appropriate edit command.

Here is the entire contents of the edit_command

    Sub gridMenuItems_EditCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs)

        e.Item.Edit = False

        GetItemForEditing(e.CommandArgument)
        Dim grid As RadGrid = source
        grid.DataBind()
    End Sub

As you can see, I thought it was maybe stuck in edit mode, so the buttons were all disabled behind the scenes, but setting item.edit = false had no effect.

I've tried debugging my way around the client, but had no luck so far.

If anyone has any idea what is eating the event, please let me know.
Or, if anyone can tell me where to set a breakpoint so I can find it, I'll take that too.


I would package this up, but the page is insane complex, so please don't ask.

I might try putting two standalone grids in 2 accordion panes and see if it does the same thing or not.

thanks in advance for any ideas.





2 Answers, 1 is accepted

Sort by
0
Accepted
Rosen
Telerik team
answered on 17 Oct 2008, 12:32 PM
Hi Bob,

I suspect that the problem you are facing is due to the accordion's implementation.It seems that the accordion control renders different control ids after a postback. Therefore the Asp.NET cannot handle correctly postback event bubbling and inner controls' RaisePostBack events are not fired.

You can easily recreate this simply by adding a button inside an accordion's panes similar to this:

 <ajaxToolKit:Accordion runat="server" ID="Accordion1">              
            <Panes> 
                <ajaxToolKit:AccordionPane runat="server" ID="AccordionPane1">  
                    <Header> 
                        1  
                    </Header> 
                    <Content> 
                        <asp:Button ID="ImageButton1" runat="server" CommandName="Edit" CausesValidation="False" 
                            CommandArgument='1' OnClick="ImageButton1_Click"/>  
                    </Content> 
                </ajaxToolKit:AccordionPane> 
                <ajaxToolKit:AccordionPane runat="server" ID="AccordionPane2">  
                    <Header> 
                        2  
                    </Header> 
                    <Content>      
                        <asp:Button ID="Button1" runat="server" CommandName="Edit" CausesValidation="False" 
                            CommandArgument='1' OnClick="ImageButton1_Click"/>                    
                    </Content> 
                </ajaxToolKit:AccordionPane> 
            </Panes> 
        </ajaxToolKit:Accordion> 

If you set a breakpoint inside buttons' click handler you will notice that when click for the first time the event is not thrown.

Sincerely yours,
Rosen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Bob
Top achievements
Rank 1
answered on 17 Dec 2008, 10:17 PM
Just FYI, this is actually a known bug if you go scan around in the codeplex AJAX library.
There is even a fix from August 2008, which did get rid of my problem.

Unfortunately, I think the Accordion control has more nugs in it.
I have had so many problems getting telerik controls to reliably function inside an accordion, that I am skipping the accordion from now on, unless it is a very simple task and it works right off the bat.

Hope this helps someone else...
Tags
Grid
Asked by
Bob
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Bob
Top achievements
Rank 1
Share this question
or