asp.netaspxgridviewautopostback

AspxGridView: How to Disable PostBack When I Click on Button Inside of DataItemTemplate?


I have an AspxGridView and it has a Button inside of a column's DataItemTemplate. When the value of this column is "0", the image of button is X, when it's "1", the image is a tick. Like yes/no.

So my system is working this way: I click on the button, there comes an edit form, when I edit it, I change the value from 0 to 1, then the image becomes tick. Like "edited/unedited".

I've placed the edit form inside of an AspxPopupControl, it works normal but slow. Because the grid has too many rows and the button causes postback before the popup appears. That's because I'm setting the PopupControl.ShowOnPageLoad to true.

I tried also javascript window.open function to avoid from this postback. But since it's a button, it makes postback anyway. If I disable postback from Button properties it has no action.

I used an imagebutton, or imagelink, but I also have to get the ID with Eval, couldn't figure how to do that.

So, I need to open an edit form, doesn't matter with popup control or new popup page, and I need to do this without postback. I can use a different control inside of DataItemTemplate, just need to get the key value of the row.

Any suggestions?


Solution

  • I recommend using the built-in popup EditForm template: http://demos.devexpress.com/ASPxGridViewDemos/GridEditing/PopupEditForm.aspx

    Also, use the built in check box column type. These changes should give you better performance.