I have this problem with a button which is in the aspxgridview.The button should show a pop up with some extra details which is located below the aspxgridview, so the ID(I have put it in the commandargument) is needed to show the extra details. But when I use the filterfunction, the commandargument doesn't change. It still has the same ID as before filtering. So when i click on my custom button the wrong data is shown.
Thank you for contacting us. However, your scenario is not quite clear to me. Is it possible to describe it in greater detail and provide us with a working sample project, so that we can examine it on our side (some screenshots, illustrating the actual and expected behavior will be helpful).
P.S. Please take a look at the Templates - Cell Online Demo regarding this issue. Does it meet your requirements?
I am using asp image buttons and buttons in the devexpress gridview. I am binding the command argument of them with the id of respective records. When we click on that button it will open a popup and will display the details according to the id. So now if I click on the button of a record for the first time, it is displaying the data corresponding to that id. Then I will apply filter to the grid. Now if I click on any other record, it is still taking the previous id in the command argument instead of the fresh record and hence display the wrong data.
Unless I am mistaken, you assign the CommandArgument property of the ImageButton as follows:
<dx:gridviewdatatextcolumn UnboundType="String" VisibleIndex="4"> <dataitemtemplate> <asp:imagebutton ID="btn1" runat="server" ImageUrl="~/Images/button.jpg" CommandArgument='<%#Eval("ProductID") %>' /> </dataitemtemplate> </dx:gridviewdatatextcolumn>
In this situation please set the ViewState property of the ASPxGridView to false.
In this case I suggest that you do not use the server-side RowConnamd event.
This task has many alternative solutions.
One of them is to add an attribute to each ImageButton using the HtmlRowCreated event of the ASPxGridView control.
On the client Click of this button, you can get the corresponding row ID from this attribute and snow a popup.
I have attached a sample that illustrates this solution.