Ticket Q408144
Visible to All Users

ASPxCheckBox inside ASPxGridView - The CheckedChanged event is not raised when the grid is filtered

created 13 years ago

Hi,

I have an aspxGridview in which there is aspxcheckbox. Druing the
OnCheckedChanged event, I identify the row using visible index and perform some db operations. This grid also has filtering enabled. My issue is that, if the grid is not filtered, when checking/unchecking the checkbox, the OnCheckedChanged event is fired. But when I apply some filtering by entering some text in the "Name" column, the OnCheckedChanged does not fire (at times). Can you please give me some inputs regarding this? Also an example similar to this would be most helpful.

This thread doesn't help me : http://www.devexpress.com/Support/Center/p/Q308425.aspx

steps to reproduce

  1. add aspxgridview to page inside update panel
  2. bind it
  3. add item template and add aspxcheckbox to it binding it to column
  4. now filter aspxgridview row with some value and check the check box
    The chkChanged event doesnt fire first time. You have to uncheck it and check it again to fire event

Let me know.

Thanks,
Nihir

Answers

created 13 years ago (modified 13 years ago)

Hello Nihir,
This problem usually occurs when a control is located inside the DataItemTemplate, so it has a static ID. In this case, multiple control instances are created with the same ID. As a result, it is impossible to determine which check box raises an event, and PostData cannot be loaded correctly when processing a grid's callback. To overcome this issue, define a unique ID for each template control. For instance, you can do this in the control’s Init event handler based on the row key value:

ASPx
<DataItemTemplate> <dx:ASPxCheckBox ID="cb1" runat="server" onInit="cb1_Init"> </dx:ASPxCheckBox> </DataItemTemplate>
C#
protected void cb1_Init(object sender, EventArgs e) { ASPxCheckBox cb = sender as ASPxCheckBox; GridViewDataItemTemplateContainer container = cb.NamingContainer as GridViewDataItemTemplateContainer; cb.ID = "cb" + container.KeyValue; }

In addition, disable the grid's ViewState.

    Show previous comments (1)
    DevExpress Support Team 13 years ago

      I have studied your problem.
      Unfortunately, this is a specific behavior of DataItem templates. ASPxGridView recreates its hierarchy after calling the DataBinding function. This is why information about post data loading is lost. Please describe your scenario, maybe we can help you replace the UpdatePanel with the ASPxCallbackPanel.

        I am also facing the same problem also tried the above given solution but nothing happened ,So please provide some suitable solution for the same …thanks in advance

        DevExpress Support Team 10 years ago

          Hello,

          To process your recent post more efficiently, I created a separate ticket on your behalf: T292408: The CheckedChanged event is not raised when the grid is filtered. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.