GridView RowCreated Event

Hi all

I have a gridview and I am assigning a method to the RowCreated event:


LocationGV.RowCreated += new GridViewRowEventHandler(LocationGV_RowCreated);

Now I want to acces the RowIndex like this:



        void LocationGV_RowCreated(object sender, GridViewRowEventArgs e)
        {
            Dictionary<long, bool> selectedLocations = (Dictionary<long, bool>)Session["selectedLocations"];
            GridViewRow row = e.Row;
            CheckBox cb = (CheckBox)row.FindControl("LocationCB");
            long dealerId = Convert.ToInt64(LocationGV.DataKeys[row.RowIndex].Value);

}


My Problem is with the row.RowIndex code. It is -1 for some reason. Any thoughts?
Thanks
AFrieze

Alright, Solved this one too.

Apparently you have to check the RowType and make sure your looking ate a datarow, like so.

    void LocationGV_RowCreated(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {