data pager in listview Issue
<p>I have a listview where in I placed datapager as follows.
I am using SQl datasource and binding the records to ListView.</p>

<pre><code>asp:ListView runat="server" ID="ListView1" DataKeyNames="ProductId,GameName" DataSourceID="GameTable" OnItemCommand="On_Select_Item" 
</code></pre>

<p>and datapager in the LayoutTemplate</p>

<p>And in the item template I am placing a button, when clicked it calls a method where i am trying to fetch DatakeyName values. It is working fine in first page when pager is given, However when moved to other page in the pager, it is throwing me an exception.
Here is the button click code,</p>

<pre><code>protected void On_Select_Item(object sender, ListViewCommandEventArgs e)
    {

        if (String.Equals(e.CommandName, "AddtoCart"))
        {
            //checks if the user is logged in
            if (User.Identity.IsAuthenticated)
            {
                ListViewDataItem dataItem = (ListViewDataItem)e.Item;
                DropDownList dl = e.Item.FindControl("DropDownList") as DropDownList;
                String val="";

                if (dl != null)
                {
                    val = dl.SelectedValue; //Get the selected value from DropDownList
                }
                String price = Convert.ToString(e.CommandArgument).Trim(); //Get the price for the selected game.
</code></pre>

<p>-------------Exception is thrown at below line ---------</p>

<pre><code>          string ProductId =
            ListView1.DataKeys[dataItem.DataItemIndex]["ProductId"].ToString(); //Product Id for the selected game.
            string GameName = ListView1.DataKeys[dataItem.DataItemIndex]["GameName"].ToString(); //gamename

...............................
.............................
</code></pre>

<p>}</p>
