I've created a Web page in ASP.Net that has a datagrid on it. The grid has two columns: one for an order number and the other is set up as an button. The grid displays 2000 numbers at one time, and has a parameter telling it to show 20 page number buttons in its footer.

I was having a problem getting the grid to correctly display sets of data for the blocks that appear on the 21st or higher page; however, the code properly reacted to the Click event when the user clicked on a button in the second column. That is, it went to the subroutine specified in the OnItemSelect="subroutine" parameter in the HTML for the grid definition.

I've discovered that I couldn't properly display the block of data above the 20th group because I had ViewStateEnable="False". Once I changed it to True pagination works fine. However, now when the user clicks on a button in the 2nd column (to select a specific order number) the code goes to the Page_Load event and appears to ignore the event of the button being clicked, meaning that it no longer goes to the OnItemSelect="subroutine" as before.

Suggestions as to why this is now occuring and how to get it to go to the subroutine listed in the OnItemSelect parameter?

Here's the grid definition is case it helps ("<" and ">" signs have been replaced by "[" and "]" characters):

[asp:datagrid id="GridTicketNumbers" style="Z-INDEX: 101; LEFT: 16px;
POSITION: absolute; TOP: 40px" runat="server"
OnPageIndexChanged="ChangeGridPage" PagerStyle-
HorizontalAlign="Left" AllowPaging="True"
\t\t AutoGenerateColumns="False" HorizontalAlign="Left"
Height="320px" Width="168px" EnableViewState="True"
\t\t AlternatingItemStyle-BackColor="#cccccc" itemstyle-
backcolor="#ffffff" HeaderStyle-BackColor="#cccc99"
\t\t HeaderStyle-Font-Bold="True"
\t\t[asp:BoundColumn HeaderText="Ticket Number"
\t\t[asp:ButtonColumn HeaderText="Select" Text="X"
CommandName="Select" ButtonType="PushButton"]