WhateverMJ
New Member
I'm trying to get an int value from a GridView. Here is the screenshot of my gridview.http://i.imgur.com/rFkau6V.pngHere is the asp code for the Gridview I have created a RowCommand method where when I press the Remove button on the GridView it is suppose to give me the int value of the 2nd row. So for example if I was to press the last Remove button it would give me an int value of 5. This is my codebehind for the method \[code\] protected void grdOrder_RowCommand(object sender, GridViewCommandEventArgs e){ if (e.CommandName == "Remove") { int bigStore = Convert.ToInt32(grdOrder.SelectedRow.Cells[2].Text); clsStockCollection AnId = new clsStockCollection(); clsStock TheOrder = new clsStock(); TheOrder.OrderId = bigStore; AnId.DeleteOrder(TheOrder); DataCall(); }}\[/code\]When I run this code I get this error. Object reference not set to an instance of an object.I don't understand how or why I need to reference an object for example : Object As New Object. Why do I need to do this? Here is the codebehind for the full class : pastebin.com/yzLR7s2wA thanks in advance