-
1
- #1
WillShakespeare
MIS
Hi all,
Can anyone help with this? I suppose this is an ASP.NET issue, but I forgot to look to see if Tek-Tips had a separate forum... and I've already started typing... so...
I have a DataGrid on my aspx page, that has a button loaded in each row that adds to cart. The button works perfectly and took me the best part of two weeks of poring over the VS.NET documentation to firgure out how to do this!!
But now my paging doesn't work. I know exactly why it's not working... I just don't know how to get around the problem... can anyone help?
The problem is that since I added the Add To Cart button, I had to include a paramter called CommandName, with a string vale "AddToCart"... I then use this in a CartButton_Clicked(...) event to handle the code I want executed for when this button is clicked...
So the ItemCommand in the DataGrid is "CartButton_Clicked"
This all works a treat!, but now when I click Next> to go to the next page, the paging tries to call the CartButton_Clicked method, instead of the DataGrid_PageIndexChanged method!! I can't figure out why... so when the event is fired, it is interpreted by the Button's DataGridCommandEventArgs e object, rather than the Page Index method's DataGridPageChangedEventArgs e object.
I tried setting OnPageIndexChanged to ="DataGrid1_PageIndexChanged" within the DataGrid tag, but this also doesn't work...
Will
Can anyone help with this? I suppose this is an ASP.NET issue, but I forgot to look to see if Tek-Tips had a separate forum... and I've already started typing... so...
I have a DataGrid on my aspx page, that has a button loaded in each row that adds to cart. The button works perfectly and took me the best part of two weeks of poring over the VS.NET documentation to firgure out how to do this!!
But now my paging doesn't work. I know exactly why it's not working... I just don't know how to get around the problem... can anyone help?
The problem is that since I added the Add To Cart button, I had to include a paramter called CommandName, with a string vale "AddToCart"... I then use this in a CartButton_Clicked(...) event to handle the code I want executed for when this button is clicked...
So the ItemCommand in the DataGrid is "CartButton_Clicked"
This all works a treat!, but now when I click Next> to go to the next page, the paging tries to call the CartButton_Clicked method, instead of the DataGrid_PageIndexChanged method!! I can't figure out why... so when the event is fired, it is interpreted by the Button's DataGridCommandEventArgs e object, rather than the Page Index method's DataGridPageChangedEventArgs e object.
I tried setting OnPageIndexChanged to ="DataGrid1_PageIndexChanged" within the DataGrid tag, but this also doesn't work...
Will