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

ImageButton in Footer CommandItem not firing after filtering

2 Answers 19 Views
Grid
This is a migrated thread and some comments may be shown as answers.
guillaume.lebel
Top achievements
Rank 1
Iron
guillaume.lebel asked on 17 Oct 2013, 03:34 PM
Hi,

I'm currently having a strange issue with my grid.

When i filter/sort my grid and then try to use one button in the footer command item the server side click event is not firing, but if i click it again it work fine. The problem is only with the footer and immediatly after filtering/sorting it.

The button in the header commanditem who is created the same way work fine no mather if i filter, sort or something like that.

This is a server side Grid. All my grid structure is created at page init. The command item section contain an itemtemplate where we create only controls needed for our page, but the controls are created outside the itemtemplate and then pass to the constructor like this :

public class CommandItemTemplate : ITemplate
{
    private readonly CommandItems m_CommandItems;
 
    public CommandItemTemplate (CommandItems commandItems)
    {
        m_CommandItems = commandItems;
    }
 
    public void InstantiateIn(Control container)
    {
        //ContentPanel is an aspPanel which contains every control created on the page Init
     
        if (container.BindingContainer.BindingContainer is GridTFoot && m_CommandItems.Footer != null)
        {
            container.Controls.Add(m_CommandItems.Footer.ContentPanel);
        }
        else if (container.BindingContainer.BindingContainer is GridTHead && m_CommandItems.Header != null)
        {
            container.Controls.Add(m_CommandItems.Header.ContentPanel);
        }
    }
}

Thank you for your help,

Guillaume

2 Answers, 1 is accepted

Sort by
0
guillaume.lebel
Top achievements
Rank 1
Iron
answered on 17 Oct 2013, 03:45 PM
Hi,

I've noticed that if I filter a 2 times in a row before using the button in the command item, the event work fine. Its only immediatly after the first filter that the action is not working properly.

Also the imagebutton ClientId seems to change on the first filter/sort and return to its first ClientId after I do another action in the page.

Guillaume
0
Angel Petrov
Telerik team
answered on 22 Oct 2013, 11:13 AM
Hello Guillaume,

I tried reproducing the unwanted behavior in an isolated sample but to no avail. As you can see from the attached test website the click event handler gets hit after the items are filtered. The only difference from your scenario is that the button is created inside the template. That said please try creating the controls like shown in the test sample and test whether this resolves the issue. If it does not I would like to ask you to show us the entire content of the problematic page so we could research more thoroughly what is causing the problem on hand.

Regards,
Angel Petrov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
guillaume.lebel
Top achievements
Rank 1
Iron
Answers by
guillaume.lebel
Top achievements
Rank 1
Iron
Angel Petrov
Telerik team
Share this question
or