According to your comment (not in your original post) you are getting an exception.
Quote:
object reference not set to an instance of an object
I think it is this line that is firing that exception
String name = GridView1.Rows[4].Cells[4].FindControl("Business_Name").ToString();
Firstly, I don't think you need the
.FindControl("Business Name")
- you don't have a control called that - it's the title of one of your columns... column index 4 in fact.
Secondly, you are always looking at row index 4 on your datagrid ... what if you haven't got 5 rows in there?
Both of these issues could have produced that error.
Now to solve it ...
That parameter
GridViewCommandEventArgs e
comes in handy for finding the row that was selected...
int i = Convert.ToInt32(e.CommandArgument);
GridViewRow r = GridView1.Rows[i];
Next you want the cell that corresponds to the "Business Name" column - I already know that this is column index 4 so your code becomes
String name = r.Cells[4].Text;
If you don't want to Hard-Code the column number (and you shouldn't want to) have a look at
this post on StackOverflow[
^] to get the column based on its name